0
0 комментариев
from random import *
from tkinter import *
from PIL import ImageTk, Image
root = Tk()
root.geometry("600x600")
root.title("НЕ СМОТРЕТЬ")
canvas = Canvas(root, width = 600, height = 600, bg = "white")
canvas.pack()
root.iconbitmap(r"c:\Users\пашКА\PycharmProjects\Sneyka\apple-128 (1).ico")
def kvadro(x, y):
    canvas.create_line(x, y, x + 100, y)
    canvas.create_line(x + 100, y, x + 100, y + 100)
    canvas.create_line(x, y, x, y + 100)
    canvas.create_line(x, y + 100, x + 100, y + 100)
    canvas.create_text(x + 50, y - 10, text= "a", font="Impact 20 bold", fill="black")
    canvas.create_text(x + 50, y + 110, text= "a", font="Impact 20 bold", fill="black")
    canvas.create_text(x - 10, y + 50, text = "b", font="Impact 20 bold", fill="black")
    canvas.create_text(x + 110, y + 50, text = "b", font="Impact 20 bold", fill="black")
def formu(x, y):
    canvas.create_text(x, y, text="2(bc) = 2b * 2c", font="Impact 20 bold", fill="darkred")
def gg(event):
    x = randint(0, 600)
    y = randint(0, 600)
    z = randint(0, 2)
    '''if z == 0:
        canvas.create_text(x, y, text="P = 2 * (a * b)", font="Impact 20 bold", fill="darkblue")
    elif z == 1:
        kvadro(x, y)
    else:
        formu(x,y)'''
    canvas.update()
    open_img = Image.open("!win.png")
    img = ImageTk.PhotoImage(open_img)
    ogo = canvas.create_image(x, y, image=img)
    canvas.update()
    #canvas.delete(ogo)

root.bind("<Tab>", gg)
root.mainloop()
Решенный вопрос
Добавить комментарий