Python:虚拟键盘按钮没有显示

时间:2016-01-27 14:39:10

标签: python user-interface python-3.x

我正在尝试使用python 3.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)

0 个答案:

没有答案