17

I am using Tkinter.

import Tkinter as tk

class App(tk.Frame):
  def __init__(self, *args, **kwargs):
    tk.Frame.__init__(self, *args, **kwargs)
     ....
root = tk.Tk()
root.title("title")

app = App(root)
root.mainloop() 

Does it has a refresh? Because I want to refresh my frame. Is root.refresh() is possible?

MatthewMartin
  • 32,326
  • 33
  • 105
  • 164
gadss
  • 21,687
  • 41
  • 104
  • 154

2 Answers2

30

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.

Junuxx
  • 14,011
  • 5
  • 41
  • 71
  • thanks junuxx for the reply, but I think it is not what I am looking for... I am trying do some changes on Tkinter UI... I have post the question here http://stackoverflow.com/questions/19462431/python-tkinter-label-changing-text-value-by-button-command#19462431 I hope you have some idea, thanks – gadss Oct 20 '13 at 13:21
5

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__().