我正在尝试用python3.5做一个屏幕键盘。但是,当我试图运行程序时,只有空格按钮出现,而不是其余的。你知道吗
buttons = [
'q','w','e','r','t','y','u','i','o','p','<-','7','8','9','-',
'a','s','d','f','g','h','j','k','l','[',']','4','5','6','+',
'z','x','c','v','b','n','m',',','.','?','&','1','2','3','/',
'SPACE',
]
label1 = Label(Keyboard_App,text=("\n")).grid(row = 0,columnspan = 1)
entry = Entry(Keyboard_App, width = 128)
entry.grid(row = 1, columnspan = 15)
varRow = 2
varColumn = 0
for button in buttons:
command = lambda x = button: select(x)
if button != "Space":
tkinter.Button(Keyboard_App, text = button, width = 5,bg = "#000000",fg = "#ffffff",
activebackground = "#ffffff", activeforeground = "#000000", relief = 'raised',padx = 4,
pady = 4, bd = 4, command = command).grid(row = varRow, column = varColumn)
if button == "Space":
tkinter.Button(Keyboard_App, text = button, width = 60, bg = "#000000",fg = "#ffffff",
activebackground = "#ffffff", activeforeground = "#000000", relief = 'raised',
padx = 4, pady = 4, bd = 4, command = command).grid(row = 6, columnspan = 16)
目前没有回答
相关问题 更多 >
编程相关推荐