我怎样才能制作一个只有数字键的字母键盘

2024-09-28 21:36:26 发布

您现在位置:Python中文网/ 问答频道 /正文

我试图制作一个键盘,但我想让它只使用一个小键盘和键盘上的按钮,但是我的代码对a和b部分似乎不起作用。我已经评论了哪一部分

if "1" in line:
    if kytype == 'a':
        kytype = "k"
    elif kytype == 'b': #when this part is runned it prints a 'b' instead
        kytype == "u"   # of a 'u'
    elif kytype == " ":
        kytype = "a"
elif "2" in line:
    if kytype == 'a':
            kytype = "l"
    elif kytype == 'b':
            kytype == "v" #it happens here too and instead of printing a
    elif kytype == " ":   # 'v' it prints a 'b'
            kytype = "b"
#I haven't done the rest of the code for other letters because of the
#problem
elif line = 'ins':
    print(kytype)
    kytype = " "

Tags: ofthe代码inifline评论it