Hello Guys!🤞🏼
After a while, I wrote a dumb finder program that written by Python just for FUN!!😂
What is your idea to improve our Dumb finder program?🤔
`#------------ * Start coding * -----------
from tkinter import *
from tkinter import messagebox
from random import randint
Importing needed packages
my_window = Tk()
Create an instance of window
my_window.geometry("350x200")
Set the geometry of the window
my_window.title("Dumb Finder")
Window title
text = Label(my_window, text="Are You Dumb?" , font=("Hobo Std",14,"bold")).pack(pady=50)
define a label(text)
def no_changer():
random_x = randint(0,150)
#gives random x for no button
random_y = randint(0,150)
#gives random y for no button
no_btn.place(x=random_x, y=random_y)
#place no button by random-generated x , y
def yes_alert():
messagebox.showinfo("Dumb Founded!", "I KNOW <3")
#show message
my_window.quit()
#close window after clicking Ok
no_btn = Button(my_window, text= "No" , width=5 , font=30, command=no_changer)
define No button and send to no_changer function
no_btn.place(x=100, y=100)
place no button in x=100 , y=100
yes_btn = Button(my_window, text= "Yes" , width=5 , font=30, command=yes_alert)
define Yes button and send to yes_alert function
yes_btn.place(x=200, y=100)
place Yes button in x = 200 , y=100
my_window.mainloop()
Top comments (4)
I think your code is missing some quotation marks.
where?
Sorry. I think i misunderstood your post. I thought the whole block starting on the "Start coding" was supposed to be formatted as code.
Like this ->
pay more attention about code that you copied! there are more comments that you missed their #. if you want help, it is my pleasure to help you!