Ich brauche hilfe :K
Ich habe heraus gefunden wie man mit qpython Alert Dialog press Events macht.
Das hat auch funktioniert aber in qpy 3 kommt dieser Fehler:
Traceback (most recent call last):
File "/storage/emulated/0/qpython/.last_tmp.py", line 9, in <module>
if response.has_key("which"):
AttributeError: 'dict' object has no attribute 'has_key'
1|u0_a340@a3y17lte:/ $
Hier mein code:
import android
droid=android.Android()
droid.dialogCreateAlert("T3 install","T3 Will be installed")
droid.dialogSetPositiveButtonText("Okay")
droid.dialogSetNegativeButtonText("Cancel")
droid.dialogShow()
response=droid.dialogGetResponse().result
droid.dialogDismiss()
if response.has_key("which"):
result=response["which"]
if result=="positive":
print ("Okay")
elif result=="negative":
print ("Cancel")
Könnt ihr mir bitte helfen? :K
has_key() in qpython3
Mit in geht das auch nicht:
import android
droid=android.Android()
droid.dialogCreateAlert("T3 install","T3 Will be installed")
droid.dialogSetPositiveButtonText("Okay")
droid.dialogSetNegativeButtonText("Cancel")
droid.dialogShow()
response=droid.dialogGetResponse().result
droid.dialogDismiss()
if response.has_key("which"):
result=response["which"] in ('positive', 'negative')
if result=="positive":
print ("Okay")
elif result=="negative":
print ("Cancel")
import android
droid=android.Android()
droid.dialogCreateAlert("T3 install","T3 Will be installed")
droid.dialogSetPositiveButtonText("Okay")
droid.dialogSetNegativeButtonText("Cancel")
droid.dialogShow()
response=droid.dialogGetResponse().result
droid.dialogDismiss()
if response.has_key("which"):
result=response["which"] in ('positive', 'negative')
if result=="positive":
print ("Okay")
elif result=="negative":
print ("Cancel")