python-tkinter-komponent-canvas

demo
原文

1. Canvas

1
2
3
4
5
6
7
8
9
10
canvas = tkinter.Canvas(root, height = 300, width = 300)
canvas.pack()
canvas.create_line(
0,
0,
200,
200,
fill = "red",
dash = (4,4)
)

2. tags of canvas

1
2
3
4
5
6
# the tags
item = canvas.create_line(0, 0, 100, 100, tags="uno")
canvas.itemconfig(item, tags=("one", "two"))
canvas.addtag_withtag("three", "one")
canvas.gettags(item)
canvas.find_withtag("one")

3. other functions

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# other functions
coords(item, *coords)
create_arc(bbox, **options)
create_bitmap(position, **options)
create_image(position, **options)
create_line(coords, **options)
create_oval(bbox, **options)
create_polygon(coords, **options)
create_rectangle(bbox, **options)
create_text(position, **options)
create_window(position, **options)
dchars(item, from, to=None)
delete(item)
dtag(item, tag=None)
find_above(item)
find_all()
find_below(item)
find_closest(x, y, halo=None, start=None)
find_enclosed(x1, y1, x2, y2)
find_overlapping(x1, y1, x2, y2)
find_withtag(item)
focus(item=None)
gettags(item)
icursor(item, index)
index(item, index)
insert(item, index, text)
itemcget(item, option)
itemconfig(item, **options)
itemconfigure(item, **options)
lift(item, **options)
lower(item, **options)
move(item, dx, dy)
postscript(**options)
scale(self, xscale, yscale, xoffset, yoffset)
scan_dragto(x, y)
scan_mark(x, y)
select_adjust(item, index)
select_clear()
select_from(item, index)
select_item()
select_to(item, index)
tag_bind(item, event=None, callback, add=None)
tag_lower(item)
tag_raise(item)
tag_unbind(self, item, event)
tkraise(item, **options)
xview(how, *args)
xview_moveto(fraction)
xview_scroll(number, what)
yview(how, *args)
yview_moveto(fraction)
yview_scroll(number, what)

×

纯属好玩

扫码支持
扫码打赏,你说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

文章目录
  1. 1. 1. Canvas
  2. 2. 2. tags of canvas
  • 3. other functions
  • ,