python - How to get the size of a tkinter Button? -
how can size of button object?
if do:
quitbutton = button(self, text="quit", command=self.quit) _x = quitbutton.winfo_width() _y = quitbutton.winfo_height() print _x, _y it prints 1 1.
what doing wrong?
the size 1x1 until drawn on screen, since size partly controlled how managed (pack, grid, etc).
you can call self.update() after you've put on screen (pack, grid, etc) cause drawn. once drawn, winfo_width , winfo_height commands work.
Comments
Post a Comment