Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from tkinter import *
- global start
- start = False
- def rect():
- x = 0
- x1 = 10
- y = 0
- y1 = 10
- tag = '1'
- def binder(x, x1, y, y1, tag):
- c.create_rectangle(x,y,x1,y1,tag = tag, fill='white')
- c.tag_bind(tag,'<Button-1>',lambda event: c.itemconfig(tag,c.itemconfig('group1',fill='red',width=3),fill='red',width=3))
- while x1 != 1450 and y1 != 910:
- binder(x, x1, y, y1, tag)
- x = x + 10
- x1 = x1 + 10
- tag = str(int(tag) + 1)
- if x1 == 1450:
- x = 0
- x1 = 10
- y = y + 10
- y1 = y1 + 10
- def start_game():
- global c
- c = Canvas(w,width = 1450,height = 910)
- c.pack()
- button = Button(w,width = 12,height = 2,text = 'Выход',bg = 'red',fg = 'black',command = lambda: w.destroy())
- button.place(x = 0,y = 0)
- rect()
- def main():
- global w
- w = Tk()
- w.attributes('-fullscreen',True)
- button = Button(w,width = 12,height = 2,text = 'Выход',bg = 'red',fg = 'black',command = lambda: w.destroy())
- button.place(x = 0,y = 0)
- button1 = Button(w,width = 12,height = 2,text = 'Начать',bg = 'red',fg = 'black',command = lambda: start_game())
- button1.place(x = 500,y = 500)
- w.mainloop()
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement