SV: Changing the size of a Button

K Viltersten tmp1 at viltersten.com
Sun Mar 9 14:45:58 EDT 2008


>> How do i change the size of a Button
>> (using Tkinter), other than to set it
>> during construction?
> In Tkinter, usually the geometry managers 
> (such as pack) are the ones who size the 
> widgets. If you run something like:
>    import Tkinter as tk
> 
>    root = tk.Tk()
>    def change_size():
>        b["text"] = "More text"
> 
>    b = tk.Button(root, text="Text", command=change_size)
>    b.pack()
> 
>    root.mainloop()

Thanks for the answer.

Unfortunately, that won't help me at all, 
since i, apparently, asked the wrong 
question. Let me refrain myself.

What i wish to do is to affect the size 
of the button but not due to change of 
text but due to resize of the frame it
resides in.

This far i've managed to get a callback 
to a function as the resize occurs and to
print the sizes. However, i'd like to 
assign these values to the button so it 
always stays the same width as the frame.

--
Regards
Konrad Viltersten
--------------------------------
sleep    - a substitute for coffee for the poor
ambition - lack of sense to be lazy




More information about the Python-list mailing list