From 35426ab9317a11691d20fb89c4cec7284f1f0dff Mon Sep 17 00:00:00 2001 From: justuser Date: Thu, 23 Nov 2023 19:17:09 +0300 Subject: [PATCH] Delete 'map.py' --- map.py | 55 ------------------------------------------------------- 1 file changed, 55 deletions(-) delete mode 100644 map.py diff --git a/map.py b/map.py deleted file mode 100644 index ba95cac..0000000 --- a/map.py +++ /dev/null @@ -1,55 +0,0 @@ -import urllib.request -import time -from PIL import Image, ImageTk -import io -import tkinter as tk - -url = "https://pb.gulyaipole.fun/" - -root = tk.Tk() -canvas = tk.Canvas(root) -canvas.pack() - -root.geometry("1024x800") -root.tk.call('wm', 'iconphoto', root._w, tk.PhotoImage(file='map.png')) -ttext = tk.Canvas(root, width=90, height=20, bg="black") -ttext.place(x=940, y=0) -text = ttext.create_text(40, 10, text="X: 1, Y: 1", fill="white") - -while True: - x = root.winfo_pointerx() - root.winfo_rootx() - y = 800 - (root.winfo_pointery() - root.winfo_rooty()) - ttext.itemconfig(text, text=f"X: {x}, Y: {y}") - - # Открываем URL как файл - image_file = io.BytesIO(urllib.request.urlopen(url).read()) - - # Открываем изображение в PIL - img = Image.open(image_file) - - # Преобразуем изображение в формат, поддерживаемый Tkinter - tk_img = ImageTk.PhotoImage(img) - - # Создаем новый Canvas для вывода изображения - canvas = tk.Canvas(root, width=img.size[0], height=img.size[1]) - canvas.create_image(0, 0, anchor="nw", image=tk_img) - #canvas.pack() - canvas.place(x=0, y=0) - - try: - canvas_old.destroy() - except: - pass - - canvas_old = canvas - tk.Misc.lift(ttext) - - # Обновляем окно - root.update() - time.sleep(0.1) - -root.mainloop() - - - -