MCPcopy Create free account
hub / github.com/geekcomputers/Python / move_logo

Function move_logo

Image-watermarker/app.py:68–87  ·  view source on GitHub ↗
(e)

Source from the content-addressed store, hash-verified

66
67
68def move_logo(e):
69 global logo, new_x, new_y
70 canvas_width = image_canvas.winfo_width()
71 canvas_height = image_canvas.winfo_height()
72 label_width = image_canvas.bbox(logo)[2] - image_canvas.bbox(logo)[0]
73 label_height = image_canvas.bbox(logo)[3] - image_canvas.bbox(logo)[1]
74
75 new_x = e.x
76 new_y = e.y
77
78 if new_x < 0:
79 new_x = 0
80 elif new_x + label_width > canvas_width:
81 new_x = canvas_width - label_width
82
83 if new_y < 0:
84 new_y = 0
85 elif new_y + label_height > canvas_height:
86 new_y = canvas_height - label_height
87 image_canvas.coords(logo, new_x, new_y)
88
89
90def move_text(e):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected