Skip to content

Commit 7d59790

Browse files
committed
tkinter canvas
1 parent 692285a commit 7d59790

File tree

2 files changed

+28
-1
lines changed

2 files changed

+28
-1
lines changed

tkinter/scrolled-frame-canvas/example-canvas-1.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def test_checkbuttons():
2323
data = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't']
2424
variables = []
2525

26-
f = tk.Frame(s)
26+
f = tk.Frame(s._canvas)
2727

2828
# add widgets to frame - as parent you uses `f`
2929
for txt in data:
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import tkinter as tk
2+
from PIL import ImageTk
3+
from scrolledcanvas import ScrolledCanvas
4+
5+
# --- functions ---
6+
7+
# --- main ---
8+
9+
root = tk.Tk()
10+
11+
# create scroller
12+
s = ScrolledCanvas(root, vertical=True, horizontal=True)
13+
s.pack(fill='both', expand=True)
14+
s._canvas['borderwidth'] = 0
15+
s['borderwidth'] = 0
16+
s['relief'] = 'flat'
17+
18+
# ---
19+
20+
photo = ImageTk.PhotoImage(file='/home/furas/Obrazy/lenna.png')
21+
label = tk.Label(s._canvas, image=photo, borderwidth=0)
22+
s.add(label)
23+
24+
# ---
25+
26+
root.mainloop()
27+

0 commit comments

Comments
 (0)