Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- # -*- coding: utf-8 -*-
- # GRID
- import tkinter as tk
- from tkinter import ttk
- ventana = tk.Tk()
- ventana.title("grid")
- ventana.config(width=400, height=300)
- caja = ttk.Entry()
- caja.grid(row=0, column=0)
- boton = ttk.Button(text="HOLA")
- boton.grid(row=0,column=1)
- etiqueta = ttk.Label(text="HOLA A TODOS")
- #etiqueta.grid(row=1,column=0)
- # expando la etiqueta a dos columnas
- etiqueta.grid(row=1,column=0, columnspan=2)
- # voy a expandir la columna 0
- ventana.columnconfigure(0, weight=1)
- # voy a expandir la fila 1
- ventana.rowconfigure(1, weight=1)
- # anclar la etiqueta
- etiqueta.grid(row=1,column=0, columnspan=2, sticky="w")
- # voy a expandir la fila 0
- ventana.rowconfigure(0, weight=1)
- # voy a expandir por direcciones a la caja de texto
- caja.grid(row=0, column=0, sticky="nswe")
- # voy a espaciar la expansión
- caja.grid(row=0, column=0, sticky="nswe", padx=10, pady=50)
- ventana.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement