Advertisement
teslariu

grid_tk

Jun 2nd, 2021
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.63 KB | None | 0 0
  1. !/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. #
  4. # posicionamiento grid
  5.  
  6. import tkinter as tk
  7. from tkinter import ttk
  8.  
  9. ventana = tk.Tk()
  10. ventana.title("Posicionamiento grid")
  11. ventana.config(bg="Light Steel Blue")
  12.  
  13. # expansión horizontal columna 1
  14. ventana.columnconfigure(1, weight=1)
  15.  
  16. # expansion vertical fila 1
  17. ventana.rowconfigure(1, weight=1)
  18.  
  19.  
  20.  
  21.  
  22.  
  23.  
  24.  
  25. entry = ttk.Entry()
  26. entry.grid(row=0, column=0)
  27.  
  28. boton = ttk.Button(text="Hola")
  29.  
  30. # anclaje (sticky) n,s, w,e y espaciado
  31. boton.grid(row=1, column=1, sticky="nsew", padx= 100, pady=50)
  32.  
  33.  
  34.  
  35. entry = ttk.Entry()
  36. entry.grid(row=2, column=2)
  37.  
  38.  
  39. ventana.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement