Tkinter, repaint?, keep size?
jim-on-linux
inq1ltd at inqvista.com
Sun Apr 6 20:12:01 EDT 2008
On Sunday 06 April 2008 13:24,
skanemupp at yahoo.se wrote:
> so my calculator is almost done for u that
> have read my previous posts.
> i have some minor problems i have to fix
> though.
>
> *one is i need to repaint once i have
> performed a calculation so that the old
> results are not left on the screen. cant
> find a method for that.
you can use "wigit".update().
The update method update will redraw wigits
as necessary. If you have the state of the
wigit set to DISABLE then set it to ACTIVE
before using .update().
>
> *another is now when i write the
> expression to be evaluated it resizes the
> window as the text grows.
> i want the windowsize and all the
> buttonplacements stay constant, how do i
> achieve this?
I like to make a separate frame for buttons.
master = Tk()
master.title =('My Project')
buttonFrame = Frame(master)
buttonFrame.grid(row = 0 column = 1)
you could use a dictionary that contains the
the text and the command and loop the key to
build the buttons. Make x = x+1, y = y+1
for row and column or otherwise as you need.
button = Button(buttonframe, text = key,
width = 2)
button1.grid(row = x, column = y, sticky =
NSEW)
put other stuff into the master using another
frame and grid it in some other column and
or row.
If you make all buttons the same size inside
the frame they will keep their size even if
you have more text then the button will
hold.
There is a lot more but this is the way I
would proceed.
jim-on-linux
http://www.inqvista.com
More information about the Python-list
mailing list