Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import random
- import sys
- import os
- import time
- import tkinter
- from tkinter import messagebox, Label, Button, StringVar
- age=StringVar
- window = tkinter. Tk()#creates a new window
- window.title("Are you old enough to smoke?")#title
- window.geometry("300x200")#window size
- window.wm_iconbitmap('favicon.ico')#icon
- photo=tkinter.PhotoImage(file="images.png")#picture in said window
- w=tkinter.Label(window, image=photo)
- w.pack()
- lbl=tkinter.Label(window, text="Please enter your age.", bg="light salmon", fg="blue2")#label text & color
- lbl.pack()
- ent=tkinter.Entry(window, text="(Your age here)", textvariable=age)
- ent.pack()
- def callback():
- button_pressed=True
- while True:
- if (age) >= 18:
- print('You are legally able to smoke.')
- else:
- print("You are not of legal age to smoke.")
- if (age)>= 18:
- print ("You are legally able to smoke cigarettes.")
- if (age)>=21:
- print("You are legally able to smoke marijuana.")
- if (age)>=40:
- print("You're above the age of forty,\nDo you really need to ask if you're old enough?")
- if (age)<=12:
- print("You're to young to smoke get out of here.")
- btn=tkinter.Button(window, text="Confirm", bg="sienna1", fg="blue2", relief="groove", command=callback())
- btn.pack()
- window.configure(background='light salmon')#back ground
- window.mainloop()# draws window
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement