Advertisement
here2share

# EntrySet_fnAVSfnB.py

Oct 10th, 2023
857
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.04 KB | None | 0 0
  1. # fnVSfn.py
  2.  
  3. import tkinter as tk
  4. from tkinter import ttk
  5.  
  6. root = tk.Tk()
  7. root.geometry("450x600+10+10")
  8.  
  9. def show_widget_properties():
  10.     current_value_x = tk.StringVar()
  11.     row = ttk.Frame(root)
  12.     row.pack(fill='x', padx=10, pady=2)
  13.  
  14.     label = ttk.Label(row, text=f'test 1', width=60, anchor='w')
  15.     label.pack(side='left', padx=5)
  16.  
  17.     entry_x = ttk.Entry(row, textvariable=current_value_x, justify='left', width=12)
  18.     entry_x.pack(side='right', fill='both', expand=True)
  19.  
  20.     x = 'works'
  21.     current_value_x.set(x)
  22.  
  23. show_widget_properties()
  24.  
  25. current_value_x = []
  26.  
  27. def show_widget_properties():
  28.     del current_value_x[:]
  29.     current_value_x.append(tk.StringVar())
  30.     row = ttk.Frame(root)
  31.     row.pack(fill='x', padx=10, pady=2)
  32.  
  33.     label = ttk.Label(row, text=f'test 2', width=60, anchor='w')
  34.     label.pack(side='left', padx=5)
  35.  
  36.     entry_x = ttk.Entry(row, textvariable=current_value_x[-1], justify='left', width=12)
  37.     entry_x.pack(side='right', fill='both', expand=True)
  38.  
  39.     x = 'works'
  40.     current_value_x[-1].set(x)
  41.  
  42. show_widget_properties()
  43.  
  44. root.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement