Skip to content

Commit 064e207

Browse files
committed
How To Create Treeview Scrollbar With Python Tkinter
How To Create Treeview Scrollbar With Python Tkinter
1 parent 50a8420 commit 064e207

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

Diff for: main.py

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
2+
# Import all files from
3+
# tkinter and overwrite
4+
# all the tkinter files
5+
# by tkinter.ttk
6+
from tkinter import *
7+
from tkinter.ttk import *
8+
9+
# creates tkinter window or root window
10+
root = Tk()
11+
root.geometry('500x500')
12+
13+
# function to be called when button-2 of mouse is pressed
14+
def pressed2(event):
15+
print('Button-2 pressed at x = % d, y = % d'%(event.x, event.y))
16+
17+
# function to be called when button-3 of mouse is pressed
18+
def pressed3(event):
19+
print('Button-3 pressed at x = % d, y = % d'%(event.x, event.y))
20+
21+
## function to be called when button-1 is double clocked
22+
def double_click(event):
23+
print('Double clicked at x = % d, y = % d'%(event.x, event.y))
24+
25+
frame1 = Frame(root, height = 500, width = 500)
26+
27+
# these lines are binding mouse
28+
# buttons with the Frame widget
29+
frame1.bind('<Button-2>', pressed2)
30+
frame1.bind('<Button-3>', pressed3)
31+
frame1.bind('<Double 1>', double_click)
32+
33+
frame1.pack()
34+
35+
mainloop()

0 commit comments

Comments
 (0)