SV: Changing the size of a Button

Peter Otten __peter__ at web.de
Sun Mar 9 15:04:24 EDT 2008


K Viltersten wrote:

> 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 is done by the layout manager, too:
 
import Tkinter as tk

root = tk.Tk()
button = tk.Button(root, text="42")
button.pack(fill=tk.BOTH, expand=True)
root.mainloop()

Alternatively, with a grid layout:

button.grid(row=0, column=0, sticky="nsew")
root.rowconfigure(0, weight=1)
root.columnconfigure(0, weight=1)

Peter



More information about the Python-list mailing list