Tkinter #5: Entry widget and its attributes

 Entry widget and its attributes

The Entry widget is used to take an input from user and store it in a variable, In the tkinter there are three types of variables are available which are written below.
  • x = StringVar() # Holds a string; default value ""
  • x = IntVar() # Holds an integer; default value 0
  • x = DoubleVar() # Holds a float; default value 0.0
  • x = BooleanVar() # Holds a boolean, returns 0 for False and 1 for True
syntax for Entry widget:
************
#first we must have to define a variable and its type
x = StringVAr()
entry1 = Entry(name of window,textvariable= variable_name like x, other attributes)
entry1.pack()

# if we want to get value then use
b = x.get()
print(b)

*************
Attributes

·        bd: to set the border width in pixels.

·        bg: to set the normal background color.

·        cursor: to set the cursor used.

·        command: to call a function.

·        highlightcolor: to set the color shown in the focus highlight.

·        width: to set the width of the button.

·        height: to set the height of the button.

Comments

Popular posts from this blog

#2 Library Management Software

#3 Water remainder Programme