Advertisement
Guest User

SmokeTextWindow

a guest
Dec 9th, 2015
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.43 KB | None | 0 0
  1. import random
  2. import sys
  3. import os
  4. import time
  5. import tkinter
  6. from tkinter import messagebox, Label, Button, StringVar
  7.  
  8.  
  9. age=StringVar
  10.  
  11. window = tkinter. Tk()#creates a new window
  12. window.title("Are you old enough to smoke?")#title
  13. window.geometry("300x200")#window size
  14. window.wm_iconbitmap('favicon.ico')#icon
  15.  
  16. photo=tkinter.PhotoImage(file="images.png")#picture in said window
  17. w=tkinter.Label(window, image=photo)
  18. w.pack()
  19.  
  20. lbl=tkinter.Label(window, text="Please enter your age.", bg="light salmon", fg="blue2")#label text & color
  21. lbl.pack()
  22.  
  23. ent=tkinter.Entry(window, text="(Your age here)", textvariable=age)
  24. ent.pack()
  25.  
  26. def callback():
  27.    button_pressed=True
  28.    while True:
  29.        if (age) >= 18:
  30.             print('You are legally able to smoke.')
  31.        else:
  32.             print("You are not of legal age to smoke.")
  33.  
  34.        if (age)>= 18:
  35.             print ("You are legally able to smoke cigarettes.")
  36.        if (age)>=21:
  37.             print("You are legally able to smoke marijuana.")
  38.        if (age)>=40:
  39.             print("You're above the age of forty,\nDo you really need to ask if you're old enough?")
  40.        if (age)<=12:
  41.             print("You're to young to smoke get out of here.")
  42.        
  43. btn=tkinter.Button(window, text="Confirm", bg="sienna1", fg="blue2", relief="groove", command=callback())
  44. btn.pack()
  45.  
  46. window.configure(background='light salmon')#back ground
  47.  
  48. window.mainloop()# draws window
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement