|
| 1 | +from tkinter import * |
| 2 | +from random import * |
| 3 | +import os |
| 4 | +root=Tk() |
| 5 | +root.geometry('228x300') |
| 6 | +root.title('clicker') |
| 7 | +root.resizable(width=False, height=False) |
| 8 | +points=0 |
| 9 | +bght1=(0) |
| 10 | +def btn1f (): |
| 11 | + global points |
| 12 | + points=points+1 |
| 13 | + lb1=Label(root , text=points) |
| 14 | + lb1.grid(column=0 , row=1) |
| 15 | + print(points) |
| 16 | +def btn3f (): |
| 17 | + global points , bght1 |
| 18 | + if points >= 200: |
| 19 | + if bght1 == 0: |
| 20 | + points=points-200 |
| 21 | + lb1=Label(root , text=points) |
| 22 | + lb1.grid(column=0 , row=1) |
| 23 | + def btn12f (): |
| 24 | + global points |
| 25 | + points=points+2 |
| 26 | + lb1=Label(root , text=points) |
| 27 | + lb1.grid(column=0 , row=1) |
| 28 | + print(points) |
| 29 | + else: |
| 30 | + print('powerup already bought') |
| 31 | + root3=Toplevel() |
| 32 | + root3.resizable(width=False, height=False) |
| 33 | + lbalrdbght=Label(root3 , text='powerup already bought!') |
| 34 | + lbalrdbght.grid(column=0 , row=0) |
| 35 | + bght1=1 |
| 36 | + btn1=Button(root , text='click here!' , command=btn12f) |
| 37 | + btn1.grid(column=0 , row=0) |
| 38 | + elif points < 200: |
| 39 | + if bght1 == 1: |
| 40 | + root3=Toplevel() |
| 41 | + root3.resizable(width=False, height=False) |
| 42 | + lbalrdbght=Label(root3 , text='powerup already bought!') |
| 43 | + lbalrdbght.grid(column=0 , row=0) |
| 44 | + else: |
| 45 | + print('ERROR: NOT ENUGH POINTS. YOU HAVE {}, AND 200 ARE REQUIRED' .format(points)) |
| 46 | + root3=Toplevel() |
| 47 | + root3.resizable(width=False, height=False) |
| 48 | + lberro=Label(root3 , text='ERROR: NOT ENUGH POINTS. YOU HAVE {}, AND 200 ARE REQUIRED' .format(points)) |
| 49 | + lberro.grid(column=0 , row=0) |
| 50 | +def btn2f (): |
| 51 | + root2 = Toplevel() |
| 52 | + root2.geometry ('402x571') |
| 53 | + root2.title('store') |
| 54 | + root2.resizable(width=False, height=False) |
| 55 | + moneypath=os.path.join('money.png') |
| 56 | + money=PhotoImage(file=moneypath) |
| 57 | + lbmon=Label(root2, image=money) |
| 58 | + lbmon.place(x=0 , y=0) |
| 59 | + lbp=Label(root2 , text='|product|') |
| 60 | + lbp.grid(column=0 , row=0) |
| 61 | + lbpr=Label(root2 , text='|price|') |
| 62 | + lbpr.grid(column=1 , row=0) |
| 63 | + btn3=Button(root2 , text='2 pontos / click' , command=btn3f) |
| 64 | + btn3.grid(column=0 , row=1) |
| 65 | + lbfirstpowup=Label(root2 , text='200') |
| 66 | + lbfirstpowup.grid(column=1 , row=1) |
| 67 | + root2.mainloop() |
| 68 | +btn1=Button(root , text='click here!' , command=btn1f) |
| 69 | +btn1.grid(column=0 , row=0) |
| 70 | +btn2=Button(root , text='store' , command=btn2f) |
| 71 | +btn2.grid(column=0 , row=2) |
| 72 | +image1path=os.path.join('botao.png') |
| 73 | +image=PhotoImage(file=image1path) |
| 74 | +labelo=Label(root , image=image) |
| 75 | +labelo.grid(column=0 , row=3) |
| 76 | +root.mainloop() |
0 commit comments