検索

ホームページ  >  に質問  >  本文

python - Tkinter Label 如何改变Label中的文字样式,例如给文字加删除线

如题。未查到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))
怪我咯怪我咯2770日前1389

全員に返信(0)返信します

応答なし
  • キャンセル返事