【发布时间】:2018-04-29 09:08:12
【问题描述】:
from tkinter import *
# Create a window
spell_window = Tk()
# Give the window a title
spell_window.title('Spell Table')
table_Var = StringVar()
## table = ['T', 'a', 'b', 'l', 'e'] ## I think it needs to move through a list???
def spell_table():
s_table = monty_Var.get()
s_table += 'T' #Currently adds a 'T' each time the button is pressed
monty_Var.set(s_table)
the_label = Label(spell_window, width = 10, textvariable = table_Var,
font = ('Arial', 30), bg = 'red')
the_button = Button(spell_window, text = 'Next letter', command = spell_table)
the_label.pack(padx = 0, pady = 0)
the_button.pack(padx = 40, pady = 0)
所以基本上我已经创建了标签和按钮,并且需要通过按下一个字母按钮来拼出单词 Table。只是不知道如何让它在表格列表中移动并将它们添加到标签中。
【问题讨论】:
标签: python button tkinter label