Does Tkinter have a refresh method?

前端 未结 2 1525
小蘑菇
小蘑菇 2020-12-11 16:26

I am using Tkinter.

import Tkinter as tk

class App(tk.Frame):
  def __init__(self, *args, **kwargs):
    tk.Frame.__init__(self, *args, **kwargs)
     ....
         


        
相关标签:
2条回答
  • 2020-12-11 17:05

    There is a Tk.update() and a Tk.update_idletasks(). Both will force the UI to be refreshed, but depending on what you're actually trying to do it might not be what you're looking for.

    0 讨论(0)
  • 2020-12-11 17:09

    It's very simple :) Create a function to refresh as given below and call it using a widget.

    def refresh(self):
        self.destroy()
        self.__init__()
    

    It worked for me. All you have to do is destroy your main frame tk.Frameand call the constructor again self.__init__().

    0 讨论(0)
提交回复
热议问题