Advertisement
Guest User

Untitled

a guest
Nov 13th, 2019
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # код, до меня
  2. def forget_s(event):
  3.     global button
  4.     if button == 1:
  5.         b1.place(x=50, y=70)
  6.     elif button == 2:
  7.         b2.place(x=150, y=70)
  8.     elif button == 3:
  9.         b3.place(x=250, y=70)
  10.     elif button == 4:
  11.         b4.place(x=350, y=70)
  12.     if s.get() == 1:
  13.         b1.place_forget()
  14.         button = 1
  15.     elif s.get() == 2:
  16.         b2.place_forget()
  17.         button = 2
  18.     elif s.get() == 3:
  19.         b3.place_forget()
  20.         button = 3
  21.     elif s.get() == 4:
  22.         b4.place_forget()
  23.         button = 4
  24.     l.config(text="Кнопка скрыта:" + str(button))
  25.  
  26. # код, после меня
  27. def forget_s(event):
  28.     global button
  29.     globals()['b' + str(button)].pack()
  30.     button = s.get()
  31.     globals()['b' + str(s.get())].pack_forget()
  32.     l.config(text="Кнопка скрыта:" + str(button))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement