python - Tkinter Label 如何改变Label中的文字样式,例如给文字加删除线
怪我咯
怪我咯 2017-04-17 11:48:20
0
0
1407

如题。未查到Tkinter下,促发条件后,是否能修改label中文字的样式

class Pomodoro_app(Tk):
    def add_task(self):
        global time
        time = StringVar()
        time.set("Start")
        task_content = askstring(title = 'Add a Task', prompt = "Input a task")
        task_label   = Label(self, text = task_content, font = ("Arial, 12")).grid(column = 0, row = 3)
        task_start_button = Button(self, textvariable = time, command = self.start_working).grid(column = 1, row = 3)

    def createWidgets(self):
        self.welcome_label   = Label(self, text = "Welcome to the Challenge!", font = ("Arial, 12")).grid(column = 0, row = 0, columnspan = 2)

        self.add_task_button = Button(self, text = "Add Task", width = 20, command = self.add_task).grid(column = 0 , columnspan = 2)

    def __init__(self):
        """GUI Initiation"""
        Tk.__init__(self)
        self.createWidgets()
        """window Initiation"""
        self.resizable(False, False)
        x = (self.winfo_screenwidth() - self.winfo_reqwidth()) / 2
        y = (self.winfo_screenheight() - self.winfo_reqheight()) / 2
        self.geometry('250x400+%d+%d' % (x, y))
怪我咯
怪我咯

走同样的路,发现不同的人生

membalas semua(0)
Muat turun terkini
Lagi>
kesan web
Kod sumber laman web
Bahan laman web
Templat hujung hadapan