如何解决第二次使用`event, values = window.读取时键消失 PySimpleGUI 中的 read() `
当我第二次使用 {
"personalizations": [
{
"to": [
{
"email": "abc@abc.com","name": "abc abc"
}
],"dynamic_template_data": {
"otp": "123456","subject": "account email verification code",},}
],"from": {
"email": "noreply@johndoe.com","name": "John Doe"
},"reply_to": {
"email": "noreply@johndoe.com","template_id": "d-xxxxxxxxxxxxxxxxxxxxxxxx"
}
时,我在 <!--Step 1 SendGrid Email-->
<ClaimType Id="Otp">
<displayName>Secondary One-time password</displayName>
<DataType>string</DataType>
</ClaimType>
<ClaimType Id="emailRequestBody">
<displayName>SendGrid request body</displayName>
<DataType>string</DataType>
</ClaimType>
<ClaimType Id="VerificationCode">
<displayName>Secondary Verification Code</displayName>
<DataType>string</DataType>
<UserHelpText>Enter your email verification code</UserHelpText>
<UserInputType>TextBox</UserInputType>
</ClaimType>
<!--Step 1-->
<!--Step 2 SendGrid Email To be worked on -->
<ClaimsTransformation Id="GenerateEmailRequestBody" TransformationMethod="GenerateJson">
<InputClaims>
<InputClaim ClaimTypeReferenceId="email" TransformationClaimType="personalizations.0.to.0.email" />
<InputClaim ClaimTypeReferenceId="otp" TransformationClaimType="personalizations.0.dynamic_template_data.otp" />
<InputClaim ClaimTypeReferenceId="email" TransformationClaimType="personalizations.0.dynamic_template_data.email" />
</InputClaims>
<InputParameters>
<!-- Update the template_id value with the ID of your SendGrid template. -->
<InputParameter Id="template_id" DataType="string" Value="d-xxxxxxxxxxxxxxxxxxxxxxxxxx"/>
<InputParameter Id="from.email" DataType="string" Value="my_email@mydomain.com"/>
<!-- Update with a subject line appropriate for your organization. -->
<InputParameter Id="personalizations.0.dynamic_template_data.subject" DataType="string" Value="account email verification code"/>
</InputParameters>
<OutputClaims>
<OutputClaim ClaimTypeReferenceId="emailRequestBody" TransformationClaimType="outputClaim"/>
</OutputClaims>
</ClaimsTransformation>
<!--Step 2-->
<!--Step 3 SendGrid Email-->
<ContentDeFinition Id="api.localaccountsignup">
<DataUri>urn:com:microsoft:aad:b2c:elements:contract:selfasserted:2.1.0</DataUri>
</ContentDeFinition>
<ContentDeFinition Id="api.localaccountpasswordreset">
<DataUri>urn:com:microsoft:aad:b2c:elements:contract:selfasserted:2.1.0</DataUri>
</ContentDeFinition>
<!--Step 3-->
<!--Step 4 SendGrid Email-->
<displayControls>
<displayControl Id="emailVerificationControl" UserInterfaceControlType="VerificationControl">
<displayClaims>
<displayClaim ClaimTypeReferenceId="email" required="true" />
<displayClaim ClaimTypeReferenceId="verificationCode" ControlClaimType="VerificationCode" required="true" />
</displayClaims>
<OutputClaims>
<OutputClaim ClaimTypeReferenceId="email" />
</OutputClaims>
<Actions>
<Action Id="SendCode">
<ValidationClaimsExchange>
<ValidationClaimsExchangeTechnicalProfile TechnicalProfileReferenceId="GenerateOtp" />
<ValidationClaimsExchangeTechnicalProfile TechnicalProfileReferenceId="SendOtp" />
</ValidationClaimsExchange>
</Action>
<Action Id="VerifyCode">
<ValidationClaimsExchange>
<ValidationClaimsExchangeTechnicalProfile TechnicalProfileReferenceId="VerifyOtp" />
</ValidationClaimsExchange>
</Action>
</Actions>
</displayControl>
</displayControls>
<!--Step 4-->
<!--Step 5 SendGrid Email-->
<ClaimsProvider>
<displayName>One time password technical profiles</displayName>
<TechnicalProfiles>
<TechnicalProfile Id="GenerateOtp">
<displayName>Generate one time password</displayName>
<Protocol Name="Proprietary" Handler="Web.TPEngine.Providers.OneTimePasswordProtocolProvider,Web.TPEngine,Version=1.0.0.0,Culture=neutral,PublicKeyToken=null" />
<Metadata>
<Item Key="Operation">GenerateCode</Item>
<Item Key="CodeExpirationInSeconds">1200</Item>
<Item Key="CodeLength">6</Item>
<Item Key="CharacterSet">0-9</Item>
<Item Key="ReuseSameCode">true</Item>
<Item Key="NumRetryAttempts">5</Item>
</Metadata>
<InputClaims>
<InputClaim ClaimTypeReferenceId="email" PartnerClaimType="identifier" />
</InputClaims>
<OutputClaims>
<OutputClaim ClaimTypeReferenceId="otp" PartnerClaimType="otpGenerated" />
</OutputClaims>
</TechnicalProfile>
<TechnicalProfile Id="VerifyOtp">
<displayName>Verify one time password</displayName>
<Protocol Name="Proprietary" Handler="Web.TPEngine.Providers.OneTimePasswordProtocolProvider,PublicKeyToken=null" />
<Metadata>
<Item Key="Operation">VerifyCode</Item>
</Metadata>
<InputClaims>
<InputClaim ClaimTypeReferenceId="email" PartnerClaimType="identifier" />
<InputClaim ClaimTypeReferenceId="verificationCode" PartnerClaimType="otpToVerify" />
</InputClaims>
</TechnicalProfile>
</TechnicalProfiles>
</ClaimsProvider>
<!--Step 5-->
<!--Step 6 SendGrid Email-->
<ClaimsProvider>
<displayName>RestfulProvider</displayName>
<TechnicalProfiles>
<TechnicalProfile Id="SendOtp">
<displayName>Use SendGrid's email API to send the code the the user</displayName>
<Protocol Name="Proprietary" Handler="Web.TPEngine.Providers.RestfulProvider,PublicKeyToken=null" />
<Metadata>
<Item Key="ServiceUrl">https://api.sendgrid.com/v3/mail/send</Item>
<Item Key="AuthenticationType">Bearer</Item>
<Item Key="SendClaimsIn">Body</Item>
<Item Key="ClaimUsedForRequestPayload">emailRequestBody</Item>
</Metadata>
<CryptographicKeys>
<Key Id="BearerAuthenticationToken" StorageReferenceId="B2C_1A_SendGridSecret" />
</CryptographicKeys>
<InputClaimsTransformations>
<InputClaimsTransformation ReferenceId="GenerateEmailRequestBody" />
</InputClaimsTransformations>
<InputClaims>
<InputClaim ClaimTypeReferenceId="emailRequestBody" />
</InputClaims>
</TechnicalProfile>
</TechnicalProfiles>
</ClaimsProvider>
<!--Step 6-->
<!--Step 7 SendGrid Email-->
<ClaimsProvider>
<displayName>Local Account</displayName>
<TechnicalProfiles>
<TechnicalProfile Id="LocalAccountSignUpWithlogonEmail">
<Metadata>
<!--OTP validation error messages-->
<Item Key="UserMessageIfSessionDoesNotExist">You have exceeded the maximum time allowed.</Item>
<Item Key="UserMessageIfMaxRetryAttempted">You have exceeded the number of retries allowed.</Item>
<Item Key="UserMessageIfInvalidCode">You have entered the wrong code.</Item>
<Item Key="UserMessageIfSessionConflict">Cannot verify the code,please try again later.</Item>
</Metadata>
<displayClaims>
<displayClaim displayControlReferenceId="emailVerificationControl" />
<displayClaim ClaimTypeReferenceId="displayName" required="true" />
<displayClaim ClaimTypeReferenceId="givenname" required="true" />
<displayClaim ClaimTypeReferenceId="surName" required="true" />
<displayClaim ClaimTypeReferenceId="newPassword" required="true" />
<displayClaim ClaimTypeReferenceId="reenterPassword" required="true" />
</displayClaims>
</TechnicalProfile>
<TechnicalProfile Id="LocalAccountdiscoveryUsingEmailAddress">
<Metadata>
<!--OTP validation error messages-->
<Item Key="UserMessageIfSessionDoesNotExist">You have exceeded the maximum time allowed.</Item>
<Item Key="UserMessageIfMaxRetryAttempted">You have exceeded the number of retries allowed.</Item>
<Item Key="UserMessageIfInvalidCode">You have entered the wrong code.</Item>
<Item Key="UserMessageIfSessionConflict">Cannot verify the code,please try again later.</Item>
</Metadata>
<displayClaims>
<displayClaim displayControlReferenceId="emailVerificationControl" />
</displayClaims>
</TechnicalProfile>
</TechnicalProfiles>
</ClaimsProvider>
<!--Step 7-->
中为 event,values = window.read()
和 'IN1'
设置的键 'IN2'
和 sg.InputText(key='IN1')
不复存在。实际上 sg.Filebrowse(key='IN2',file_types= (('EXCEL FILES','*.xlsx'),))
变成了 layout
。如何设置键以使它们不会消失?我不希望 values
变成None
,我希望保留密钥。谢谢。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。