Advertisement
calfred2808

#Python Create User Widget

Jul 19th, 2020
1,338
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.66 KB | None | 0 0
  1. # the tkinter module has always to be imported as it contains the
  2. # Tk toolkit
  3. from tkinter import *
  4.  
  5. # to initialize the tkinter module we need to create a root
  6. #widget and this should be the first widget
  7. root = Tk()
  8.  
  9. # here we are setting the length and width of the screen
  10. root.geometry("500x600")
  11.  
  12. # adding text with the label widget
  13. Label(text="Enter the no of entry widget you want to create").pack()
  14.  
  15. # function to create entry widget on calling
  16. def create():
  17.     for x in range((init_val.get())):
  18.         Entry(root).pack(pady=10)
  19.  
  20. # declaring type of variable for entry widget
  21. init_val = IntVar()
  22.  
  23. # creating entry widget to take value for no of entry widgets to
  24. # b
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement