Reading screen width of a Tkinter widget.

P

peter

I recently had a problem while trying to set up a Tkinter Canvas
widget as a progress bar. Everything seemed to be working, except
that at 100% completion the progress bar spanned only about 75% of the
canvas width. Eventually I tracked the problem down to the canvas bar
'width' property as read using w=cnvProgess['width']. It turned out
the value returned was the original width of the canvas bar, and not
the screen width after the canvas had been gridded using 'sticky=W+E'.

Once I realised this it was not a show stopper, as I replaced the grid
sticky option with a specific width instruction. But this is a bit
less flexible than my original method. Is there any Tkinter command
which will return the actual dimensions of a widget which has had the
grid sticky option applied?

Peter
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top