Monday, June 20, 2022
HomeGame Developmentandroid - How one can make a timer, random numbers and a...

android – How one can make a timer, random numbers and a report for enjoying python


How one can make a timer (the preliminary time is 5 seconds, when it reaches zero, the rating is reset, aside from the report, and whenever you press the precise button, the time is restored), random numbers (whenever you press the precise button, the time is restored and provides 1 level to the rating, in addition to to the report whether it is overwhelmed. And if the rating is reset incorrectly) report for the sport (when the rating is larger than the report, it (report) overwritten and saved after exiting the sport) a hyperlink to the positioning (there shall be an icon within the nook in the event you click on on it, the positioning will open) and the way to make this sport obtainable for Android(.apk) in python? The sport code itself:

from tkinter import *
import random as rn
root = Tk()
root.title('sport')
root.geometry('720x1280')

clicks = 0
def click_button():
    world clicks
    clicks += 1
    labelClick['text'] = str(clicks)
    labelClick.pack() #Variable clicks

    rely = rn.randrange(1,10,1)
    print(rely)
    rely = str(rely) #randomizer of the right button

    if rely == '1':
        bgcolor="blue"
    if rely == '2':
        bgcolor="inexperienced"
    if rely == '3':
        bgcolor="purple"
    if rely == '4':
        bgcolor="yellow"
    if rely == '5':
        bgcolor="orange"
    if rely == '6':
        bgcolor="brown"
    if rely == '7':
        bgcolor="violet"
    if rely == '8':
        bgcolor="gray"     
    if rely == '9':
        bgcolor="pink"
    #bgcolor="blue" #random numbers and colours



    but_0 = Button(textual content=rely, width=3, top=1, bg= bgcolor, font="Hack 30", command=click_button)
    print(bgcolor)
    but_0.place(x=310, y=140)
    but_0['state'] = 'disabled' #A button with the precise button


labelClick = Label(root, textual content=clicks)
labelClick.pack()



but_1 = Button(textual content="1", width=3, top=1, bg='blue', font="Hack 30", command=click_button)
but_2 = Button(textual content="2", width=3, top=1, bg='inexperienced', font="Hack 30", command=click_button)
but_3 = Button(textual content="3", width=3, top=1, bg='purple', font="Hack 30", command=click_button)
but_4 = Button(textual content="4", width=3, top=1, bg='yellow', font="Hack 30", command=click_button)
but_5 = Button(textual content="5", width=3, top=1, bg='orange', font="Hack 30", command=click_button)
but_6 = Button(textual content="6", width=3, top=1, bg='brown', font="Hack 30", command=click_button)
but_7 = Button(textual content="7", width=3, top=1, bg='violet', font="Hack 30", command=click_button)
but_8 = Button(textual content="8", width=3, top=1, bg='gray', font="Hack 30", command=click_button)
but_9 = Button(textual content="9", width=3, top=1, bg='pink', font="Hack 30", command=click_button) #Buttons


but_1.place(x=210, y=240)
but_2.place(x=310, y=240)
but_3.place(x=410, y=240)
but_4.place(x=210, y=340)
but_5.place(x=310, y=340)
but_6.place(x=410, y=340)
but_7.place(x=210, y=440)
but_8.place(x=310, y=440)
but_9.place(x=410, y=440) #button format


root.mainloop()

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments