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

Function move_text

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

Source from the content-addressed store, hash-verified

88
89
90def move_text(e):
91 global text_label, new_x, new_y
92 canvas_width = image_canvas.winfo_width()
93 canvas_height = image_canvas.winfo_height()
94 label_width = image_canvas.bbox(text_label)[2] - image_canvas.bbox(text_label)[0]
95 label_height = image_canvas.bbox(text_label)[3] - image_canvas.bbox(text_label)[1]
96
97 new_x = e.x
98 new_y = e.y
99
100 if new_x < 0:
101 new_x = 0
102 elif new_x + label_width > canvas_width:
103 new_x = canvas_width - label_width
104
105 if new_y < 0:
106 new_y = 0
107 elif new_y + label_height > canvas_height:
108 new_y = canvas_height - label_height
109 image_canvas.coords(text_label, new_x, new_y)
110
111
112def choose_color():

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected