SHARE
TWEET

help

a guest Oct 21st, 2019 128 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. from tkinter import *
  2. import logging
  3.  
  4. root = Tk()
  5. root.title('CLICKER')
  6. root.geometry('350x200')
  7.  
  8. score = int(0)
  9. s = 0
  10. x = 1
  11. buy = 1
  12.  
  13. aga = Label (root, bg='white', fg='black', text='Твой счет:', width=50)
  14. scoreboard = Label (root, bg='white', fg='black', text=score)
  15. text = Label (root, bg='white', fg='black', width=50, text='НАЖМИ НА КНОПКУ')
  16. button1 = Button(root, bg='red', fg='white', text='CLICK', width=50)
  17. button2 = Button(root, bg='red', fg='white', text='CLOSE', width=50)
  18. buy_slot = Button(root, bg='white', fg='black', text='Купить улучшение\nза 10 очков', width=50)
  19.  
  20. def strToSortlist(event):
  21.     global x
  22.     if x == 1:
  23.         text.config(text='+1 очко')
  24.         global s
  25.         s += 1
  26.         scoreboard.config(text=s)
  27.     elif x == 2:
  28.         text.config(text='+2 очка')
  29.         s += 2
  30.         scoreboard.config(text=score)
  31.  
  32. def strDestroy(event):
  33.     root.destroy()
  34.    
  35. def strBuy(event):
  36.     global x
  37.     global score
  38.     if x == 1:
  39.         if int(score) > 10:
  40.             buy_slot.config(text='Купить улучшение за 100')
  41.             score -= 10
  42.             x += 1
  43.             text.config(text='Покупка удачная!')
  44.         elif score < 10:
  45.             text.config(text='Недостаточно очков!')
  46.  
  47. button1.bind('<Button-1>', strToSortlist)
  48. button2.bind('<Button-1>', strDestroy)
  49. buy_slot.bind('<Button-1>', strBuy)
  50.  
  51. aga.pack()
  52. scoreboard.pack()
  53. text.pack()
  54. button1.pack()
  55. buy_slot.pack()
  56. button2.pack()
  57. root.mainloop()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top