Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # fnVSfn.py
- import tkinter as tk
- from tkinter import ttk
- root = tk.Tk()
- root.geometry("450x600+10+10")
- def show_widget_properties():
- current_value_x = tk.StringVar()
- row = ttk.Frame(root)
- row.pack(fill='x', padx=10, pady=2)
- label = ttk.Label(row, text=f'test 1', width=60, anchor='w')
- label.pack(side='left', padx=5)
- entry_x = ttk.Entry(row, textvariable=current_value_x, justify='left', width=12)
- entry_x.pack(side='right', fill='both', expand=True)
- x = 'works'
- current_value_x.set(x)
- show_widget_properties()
- current_value_x = []
- def show_widget_properties():
- del current_value_x[:]
- current_value_x.append(tk.StringVar())
- row = ttk.Frame(root)
- row.pack(fill='x', padx=10, pady=2)
- label = ttk.Label(row, text=f'test 2', width=60, anchor='w')
- label.pack(side='left', padx=5)
- entry_x = ttk.Entry(row, textvariable=current_value_x[-1], justify='left', width=12)
- entry_x.pack(side='right', fill='both', expand=True)
- x = 'works'
- current_value_x[-1].set(x)
- show_widget_properties()
- root.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement