Advertisement
Guest User

Untitled

a guest
Feb 21st, 2020
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 3.11 KB | None | 0 0
  1. from tkinter import*
  2. def Register():
  3.     store_Answer = ""
  4.     print("Name = ",name.get())
  5.     print("Email = ",email.get())
  6.     print("Address = ",address.get())
  7.     print("Mobile = ",mobile.get())
  8.     print("Name = %d,\nEmail =%d,\nAddress = %d,\nMobile = %d"%(om.get(),tm.get(),hm.get(),ym.get()))
  9.     im = om.get()
  10.     mm = tm.get()
  11.     eam = hm.get()
  12.     mam = ym.get()
  13.     discount = 0
  14.     s_type = Type.get()
  15.     if im == 1:
  16.         cost = 250 * 1
  17.     if mm == 1:
  18.         cost = 250 * 3
  19.         if s_type == "student":
  20.             discount = 10
  21.         elif s_type == "official":
  22.             discount = 5
  23.         elif s_type == "general public":
  24.             discount = 0
  25.             pass
  26.     if eam == 1:
  27.         cost = 250 * 6
  28.         if s_type == "student":
  29.             discount = 15
  30.         elif s_type == "official":
  31.             discount = 10
  32.         elif s_type == "general public":
  33.             discount = 5
  34.             pass
  35.     if mam == 1:
  36.         cost = 250 * 12
  37.         if s_type == "student":
  38.             discount = 20
  39.         elif s_type == "official":
  40.             discount = 15
  41.         elif s_type == "general public":
  42.             discount = 10
  43.             pass
  44.  
  45.    
  46.     Ans.set("ชื่อสมาชิก : {} \n ราคา : {} ".format(name.get(),(cost - (cost * discount / 100))))
  47.  
  48. root = Tk()
  49. root.option_add("*Font","Consolas 24")
  50. Label(root,text = "Name = ").grid(row = 0,column = 0,stick = "sw")
  51. Label(root,text = "Email = ").grid(row = 1,column = 0,stick = "sw")
  52. Label(root,text = "Address = ").grid(row = 2,column = 0,stick = "sw")
  53. Label(root,text = "Mobile = ").grid(row = 3,column = 0,stick = "sw")
  54. Label(root,text = "Monthly = ").grid(row = 4,column = 0,stick = "sw")
  55.  
  56. Ans = StringVar()
  57. name = Entry(root)
  58. email = Entry(root)
  59. address = Entry(root)
  60. mobile = Entry(root)
  61.  
  62. name.grid(row = 0,column = 1)
  63. email.grid(row = 1,column = 1)
  64. address.grid(row = 2,column = 1)
  65. mobile.grid(row = 3,column = 1)
  66.  
  67. Type = StringVar()
  68. Label(root, text = "Type = ").grid(row = 4,column = 2,stick = "sw")
  69. Radiobutton(root,text = "Student",value = "student",variable = Type).grid(row = 4,column = 3,stick = "w")
  70. Radiobutton(root,text = "Official",value = "official",variable = Type).grid(row = 5,column = 3,stick = "w")
  71. Radiobutton(root,text = "General public",value = "general public",variable = Type).grid(row = 6,column = 3,stick = "w")
  72.  
  73. om = IntVar()
  74. Checkbutton(root,text = "1 Month",variable = om).grid(row = 4,column = 1,stick = "w")
  75. tm = IntVar()
  76. Checkbutton(root,text = "3 Month",variable = tm).grid(row = 5,column = 1,stick = "w")
  77. hm = IntVar()
  78. Checkbutton(root,text = "6 Month",variable = hm).grid(row = 6,column = 1,stick = "w")
  79. ym = IntVar()
  80. Checkbutton(root,text = "12 Month",variable = ym).grid(row = 7,column = 1,stick = "w")
  81.  
  82. Button(root,text = "Register",width = 10,command = Register).grid(row = 8,column = 3,stick = "w")
  83. Button(root,text = "QUIT",width = 10,command = quit).grid(row = 9,column = 3,stick = "w")
  84.  
  85.  
  86.  
  87. Label(root,text = "สมาชิค = ").grid(row = 9,column = 0)
  88. Label(root,textvariable = Ans).grid(row = 9,column = 1)
  89. root.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement