Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

not able to get root window resize event

Tags:

python

tkinter

im trying to display the size(dimension) of the root window (top level window) on a label. whenever the user resize the window, new window dimensions should be displayed on the label. I tried to bind the event for the root window but im getting an error as follows

TclError: bad event type or keysym "configure"

the code i used is given below. Its just a rough sample. Can anyone help me what im doing wrong.

def main():
  root=Tk()
  root.title("Test Numbers")
  root.geometry("550x350")
  def d(event):
      print event.width,event.height
  root.bind('<configure>',d)
  root.mainloop()

if __name__=="__main__":
  main()
like image 391
jithu Avatar asked Oct 08 '14 05:10

jithu


1 Answers

Case matters

There ought to be capital C

root.bind( "<Configure>", d )
like image 79
user3666197 Avatar answered Oct 05 '22 18:10

user3666197