0
0 комментариев

[apcode language=\»php\»][apcode language=\»python\»]

from tkinter import * 
  global start 
start = False
  def rect(): 
 x = 0 
 x1 = 10 
 y = 0 
 y1 = 10 
 tag = \"1\"
 while x1 != 1450 and y1 != 910: 
  c.create_rectangle(x,y,x1,y1,tag = tag) 
  c.tag_bind(tag,\'<Button-1>\',lambda event: c.itemconfig(tag,c.itemconfig(\'group1\',fill=\"red\",width=3),fill=\"red\",width=3))  
  print(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()

[/apcode]


[/apcode]

Решенный вопрос
Добавить комментарий