|
2 | 2 | # Cómo cambiar el tamaño de su aplicación con el widget de agarre de tamaño
|
3 | 3 |
|
4 | 4 | from tkinter import *
|
5 |
| -from tkinter import filedialog |
6 |
| -from tkinter import font |
| 5 | +from tkinter import ttk |
7 | 6 |
|
8 | 7 | root = Tk()
|
9 | 8 | root.title('HowToResizeYourAppWithTheSizegripWidget')
|
10 | 9 | root.iconbitmap('Python Tkinter How To Resize Your App With The Sizegrip Widget/icons/document.ico')
|
11 |
| -root.geometry("1000x660") |
| 10 | +root.geometry("400x300") |
12 | 11 |
|
| 12 | +# Make the app resizeable |
| 13 | +root.resizable(True, True) |
| 14 | + |
| 15 | +my_frame2 = Frame(root, highlightbackground="gray", highlightthickness=1) |
| 16 | +my_frame2.pack(pady=20) |
| 17 | + |
| 18 | +my_label = Label(my_frame2, text="Hello World!", |
| 19 | + font=("Helvetica", 32)) |
| 20 | +my_label.pack(pady=20, padx=20) |
| 21 | + |
| 22 | +# Reconfigure our rows and olumns for grid |
| 23 | +#root.columnconfigure(0, weight=1) |
| 24 | +#root.rowconfigure(0, weight=1) |
| 25 | + |
| 26 | +# Create a frame |
| 27 | +my_frame = Frame(root, highlightbackground="gray", highlightthickness=1) |
| 28 | +my_frame.pack(side="bottom", fill=X) |
| 29 | + |
| 30 | +# Create sizegrip |
| 31 | +my_sizegrip = ttk.Sizegrip(root) |
| 32 | +my_sizegrip.pack(side="right", anchor=SE) |
| 33 | + |
| 34 | +#my_sizegrip.grid(row=1, sticky=SE) |
13 | 35 |
|
14 | 36 |
|
15 | 37 | root.mainloop()
|
0 commit comments