- 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
Tkinter scrollbar for frame
Let’s suppose you want to organize a set of widgets inside an application window, then you can use Frames. Tkinter Frames are generally used to organize and group many widgets. For a particular application, we can also add a scrollbar in the frames. In order to add a scrollbar, we generally use to the Scrollbar(...options) function.
Example
#Import the required library from tkinter import * #Create an instance of tkinter frame or window win = Tk() #Define the geometry win.geometry("750x400") #Create a Frame frame= Frame(win) def close(): win.destroy() #Create a Label widget in the frame text= Label(frame, text= "Register", font= ('Helvetica bold', 14)) text.pack(pady=20) #ADDING A SCROLLBAR myscrollbar=Scrollbar(frame,orient="vertical") myscrollbar.pack(side="right",fill="y") #Add Entry Widgets Label(frame, text= "Username").pack() username= Entry(frame, width= 20) username.pack() Label(frame, text= "password").pack() password= Entry(frame, show="*", width= 15) password.pack() Label(frame, text= "Email Id").pack() email= Entry(frame, width= 15) email.pack() #Create widget in the frame button= Button(frame, text= "Close",font= ('Helvetica bold',14), command= close) button.pack(pady=20) frame.pack() win.mainloop()
Output
Running the above code will display a window with a frame containing Entry widgets. All the widgets in the frame are aligned vertically with a scrollbar.
- Related Articles
- How to get a horizontal scrollbar in Tkinter?
- Attach scrollbar to listbox as opposed to window in Tkinter
- Adding a scrollbar to a group of widgets in Tkinter
- How to attach a vertical scrollbar in Tkinter text widget?
- Changing the appearance of a Scrollbar in Tkinter (using ttk styles)
- How to attach a Scrollbar to a Text widget in Tkinter?
- How to attach a vertical scrollbar to a Treeview using Tkinter?
- How to Change Tkinter Frame Title?
- How to gray out (disable) a Tkinter Frame?
- Embedding a matplotlib animation into a tkinter frame
- How to clear out a frame in the Tkinter?
- Inheriting from Frame or not in a Tkinter application
- How to center a Tkinter widget in a sticky frame?
- How to place an image into a frame in Tkinter?
- How to stop Tkinter Frame from shrinking to fit its contents?

Advertisements