'Use Canvas scrollbar with the entire window, not just one widget in particular
How can I insert a vertical scrollbar on tab a using canvas? I would always using tkinter widgets in Canvas. On the web I was able to find only examples in which they connected a scrollbar to a certain widget (example list), but I want to go down and scroll the entire window of the tab a.
The code I propose has, for example, a hidden combobox because the size of the window does not allow you to view the combobox. So how can I scroll the whole window of the tab a? Thank you
import tkinter as tk
from tkinter import ttk
root = tk.Tk()
root.title("Tab Widget")
root.attributes('-zoomed', True)
tabControl = ttk.Notebook(root, style='Custom.TNotebook', width=400, height=220)
tab1 = ttk.Notebook(tabControl)
tab2 = ttk.Notebook(tabControl)
tabControl.add(tab1, text ='Tab 1')
tabControl.add(tab2, text ='Tab 2')
tabControl.place(x=1, y=1)
#tab 1
a = ttk.Frame(tab1)
b = ttk.Frame(tab1)
tab1.add(a, text="X")
tab1.add(b, text="Y")
#tab 2
c = ttk.Frame(tab2)
d = ttk.Frame(tab2)
combo1=ttk.Combobox(a, width = 18)
combo1.place(x=20, y=20)
combo1['value'] = ["text1", "text2"]
combo2=ttk.Combobox(a, width = 18)
combo2.place(x=20, y=80)
combo2['value'] = ["text1", "text2"]
combo3=ttk.Combobox(a, width = 18)
combo3.place(x=20, y=140)
combo3['value'] = ["text1", "text2"]
combo4=ttk.Combobox(a, width = 18)
combo4.place(x=20, y=200)
combo4['value'] = ["text1", "text2"]
root.mainloop()
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
