Home > Software engineering >  Scrollbar in xview in custom tkinter
Scrollbar in xview in custom tkinter

Time:12-17

How can I set the scrollbar in XView in custom Tkinter?

Scrollbar orientation is not working in horizontal view.

CodePudding user response:

import customtkinter as ctk
import tkinter as tk
root = ctk.CTk()

frame = ctk.CTkFrame(master=root)
frame.place(relx=0.5,width=300 ,height=200 ,anchor='n')
x_sroller = ctk.CTkScrollbar(master=frame ,orientation='horizontal')
x_sroller.pack(side='bottom')
text_box = tk.Listbox(master=frame ,xscrollcommand=x_sroller.set)
text_box.place(width=300 ,height=150 ,y=30)
x_sroller.configure(command=text_box.xview)
text_box.insert('end'," ".join([str(x) for x in range(1000)]))

root.mainloop()

CodePudding user response:

For customtkinter keyword is orient.

window = Tk()
frame1 = Frame(window)
scrollbar = Scrollbar(frame1, orient='horizontal')
  • Related