- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to change the Entry Widget Value with a Scale in Tkinter?
Tkinter Entry widget is an input widget that supports only single-line user input. It accepts all the characters in the text field unless or until there are no restrictions set for the input. We can change the value of the Entry widget with the help of the Scale widget. The Scale widget contains a lower value and a threshold that limits the user to adjust the value in a particular range.
To update the value in the Entry widget while updating the value of Scale widget, we have to create a variable that has to be given to both the scale and the entry widget.
Example
#Import the Tkinter Library from tkinter import * from tkinter import ttk #Create an instance of Tkinter Frame win = Tk() #Set the geometry of window win.geometry("700x350") #Create an Integer Variable to set the initial value of Scale var = IntVar(value=10) #Create an Entry widget entry = ttk.Entry(win,width= 45,textvariable=var) scale = Scale(win, from_=10, to=200, width= 20, orient="horizontal", variable=var) entry.place(relx= .5, rely= .5, anchor= CENTER) scale.place(relx= .5, rely= .6, anchor = CENTER) win.mainloop()
Output
Running the above code will display an Entry widget and a Scale which can be used to update the value in the Entry widget.
- Related Articles
- How to get the value of an Entry widget in Tkinter?
- How to use the Entry widget in Tkinter?
- How to get the value of a button in the Entry widget using Tkinter?
- How to disable an Entry widget in Tkinter?
- How to connect a variable to the Tkinter Entry widget?
- How to set focus on Entry widget in Tkinter?
- How to insert a temporary text in a tkinter Entry widget?
- Setting the focus to a specific Tkinter entry widget
- How to set the width of a Tkinter Entry widget in pixels?
- How to set default text for a Tkinter Entry widget?
- How to set the font size of Entry widget in Tkinter?
- Get contents of a Tkinter Entry widget
- How to interactively validate an Entry widget content in tkinter?
- How to use a StringVar object in an Entry widget in Tkinter?
- Getting the Cursor position in Tkinter Entry widget

Advertisements