Advertisement
Guest User

Untitled

a guest
Apr 18th, 2019
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 13.79 KB | None | 0 0
  1. from tkinter import*
  2. import sqlite3
  3. import os
  4. from tkinter import *
  5. from tkinter import messagebox as mb
  6.  
  7.  
  8. trip_date=0
  9. kategori_ticket = 0
  10. mesto_ticket = 0
  11.  
  12. def form4():
  13. window4 = Tk()
  14. window4.title("Форма4")
  15. window4.geometry("350x450")
  16. window4.resizable(False, False)
  17. form4_text = Label(window4, text = "Ввод личных данных", justify=CENTER)
  18. form4_text.configure(font = "Arial, 15", fg = "black")
  19. form4_text.pack()
  20. name_text= Label(window4, text = "Имя:")
  21. name_text.configure(font = "Arial, 10", fg = "black")
  22. name_text.place (y=50)
  23. surname_text= Label(window4, text = "Фамилия:")
  24. surname_text.configure(font = "Arial, 10", fg = "black")
  25. surname_text.place (y=80)
  26. patronymic_text= Label(window4, text = "Отчество:")
  27. patronymic_text.configure(font = "Arial, 10", fg = "black")
  28. patronymic_text.place (y=110)
  29. Date_of_Birth_text= Label(window4, text = "Дата рождения:")
  30. Date_of_Birth_text.configure(font = "Arial, 10", fg = "black")
  31. Date_of_Birth_text.place (y=140)
  32. pass_text = Label(window4, text = "Паспорт (серия -> номер):")
  33. pass_text.configure(font = "Arial, 10", fg = "black")
  34. pass_text.place (y=170)
  35. textboxname = Entry(window4, width=20)
  36. textboxname.focus_set()
  37. textboxname.place(x= 100, y=50)
  38. textboxsurname = Entry(window4, width=20)
  39. textboxsurname.focus_set()
  40. textboxsurname.place(x= 100, y=80)
  41. textboxpatronymic = Entry(window4, width=20)
  42. textboxpatronymic.focus_set()
  43. textboxpatronymic.place(x= 100, y=110)
  44. textboxDate_of_Birth = Entry(window4, width=20)
  45. textboxDate_of_Birth.focus_set()
  46. textboxDate_of_Birth.place(x= 100, y=140)
  47. textboxpassseria = Entry(window4, width=6)
  48. textboxpassseria.focus_set()
  49. textboxpassseria.place(x= 170, y=170)
  50. textboxpassnumber = Entry(window4, width=4)
  51. textboxpassnumber.focus_set()
  52. textboxpassnumber.place(x= 220, y=170)
  53. def lol():
  54. persons_name = textboxname.get()
  55. persons_surname = textboxsurname.get()
  56. persons_Date_of_Birth = textboxDate_of_Birth.get()
  57. print(persons_name, persons_surname, persons_Date_of_Birth)
  58.  
  59. buttransition2=Button(window4, text = "Подтвердить", command = lol, width=15, height=2, font=("Arial, 10"), bg ="#00c3ff")
  60. buttransition2.place(x=210, y=400)
  61.  
  62. def form3():
  63. def proverka2():
  64. if(mesto_ticket==0):
  65. exception = mb.showerror(title="Ошибка", message="Выбор места является обязательным")
  66. if(kategori_ticket==0):
  67. exception = mb.showerror(title="Ошибка", message="Выбор категории места является обязательным")
  68. if(kategori_ticket!=0 and mesto_ticket!=0):
  69. window3.destroy()
  70. form4()
  71.  
  72. ###########################---Категория билета---#######################################
  73. def kategori_click():
  74. global kategori_ticket
  75. kategori_ticket = listboxkategori.curselection()[0]+1
  76. if(kategori_ticket==1):
  77. textkategori1="Обычный "
  78. if(kategori_ticket==2):
  79. textkategori1 = "Детский "
  80. if(kategori_ticket==3):
  81. textkategori1 ="Льготный "
  82. kategori_text_2 = Label(window3)
  83. kategori_text_2.place(x=150, y=300)
  84. kategori_text_2.configure(font = "Arial, 13", fg = "black", text=textkategori1)
  85. ##################################################################
  86. ###########################---МЕСТО билета---#######################################
  87. def mesto_click():
  88. global mesto_ticket
  89. mesto_ticket = listboxmesto.curselection()[0]+1
  90. if(mesto_ticket==1):
  91. textmesto1="Верхнее "
  92. if(mesto_ticket==2):
  93. textmesto1="Нижнее "
  94. if(mesto_ticket==3):
  95. textmesto1="Верхнее-боковое "
  96. if(mesto_ticket==4):
  97. textmesto1="Нижнее-боковое "
  98. mesto_text_2 = Label(window3)
  99. mesto_text_2.place(x=60, y=350)
  100. mesto_text_2.configure(font = "Arial, 13", fg = "black", text=textmesto1)
  101. ##################################################################
  102. window3 = Tk()
  103. window3.title("Форма3")
  104. window3.geometry("350x450")
  105. window3.resizable(False, False)
  106. buttransition2=Button(window3, text = "Подтвердить", command = proverka2, width=15, height=2, font=("Arial, 10"), bg ="#00c3ff")
  107. buttransition2.place(x=210, y=400)
  108. form3_text = Label(window3, text = " Выбор категории билета и места ", bg="#00c3ff",justify=CENTER)
  109. form3_text.configure(font = "Arial, 15", fg = "black")
  110. form3_text.pack()
  111. ###############################---КАТЕГОРИЯ БИЛЕТА---###################################################
  112. textkategoti = Label(window3, text = "Категория билета:", bg="#00c3ff")
  113. textkategoti.place(relx = 0, rely = 0.220)
  114. textkategoti.configure(font = "Arial, 13", fg = "black")
  115. butkategori=Button(window3, text = "Окей", command = kategori_click, width=11, bg ="#00c3ff")
  116. butkategori.place(relx = 0, rely = 0.395)
  117. butkategori_text = Label(window3, text = "Категория билета: ")
  118. butkategori_text.place(x=0, y=300)
  119. butkategori_text.configure(font = "Arial, 13", fg = "black")
  120. listboxkategori=Listbox(window3, height=3,width=15,selectmode=SINGLE, bg="#00c3ff", selectbackground="#006da3")
  121. listboxkategori.place(relx = -0.005, rely = 0.275)
  122. listkategori=[u"Обычный", u"Детский", u"Льготный"]
  123. for i in listkategori:
  124. listboxkategori.insert(END,i)
  125. ############################################################################################
  126.  
  127. ###############################---МЕСТО---###################################################
  128. textmesto = Label(window3, text = "Место: ", bg="#00c3ff")
  129. textmesto.place(relx = 0.7, rely = 0.220)
  130. textmesto.configure(font = "Arial, 13", fg = "black")
  131. butmesto=Button(window3, text = "Окей", command = mesto_click, width=11, bg ="#00c3ff")
  132. butmesto.place(relx = 0.7, rely = 0.43)
  133. butmesto_text = Label(window3, text = "Место: ")
  134. butmesto_text.place(x=0, y=350)
  135. butmesto_text.configure(font = "Arial, 13", fg = "black")
  136. listboxmesto=Listbox(window3, height=4,width=17,selectmode=SINGLE, bg="#00c3ff", selectbackground="#006da3")
  137. listboxmesto.place(relx = 0.7, rely = 0.275)
  138. listmesto=[u"Верхнее", u"Нижнее", u"Верхнее-боковое", u"Нижнее-боковое"]
  139. for i in listmesto:
  140. listboxmesto.insert(END,i)
  141. ############################################################################################
  142.  
  143. def form2(): # ================= ФОРМА 2
  144. window.destroy()
  145. window2 = Tk()
  146. window2.title("Форма2")
  147. window2.geometry("350x450")
  148. window2.resizable(False, False)
  149. ###########################---МЕСТО ОТПРАВКИ---#######################################
  150. def butdispatchcity_click():
  151. global dispatch_city
  152. dispatch_city = listbox1.curselection()[0]+1
  153. if(dispatch_city==1):
  154. textcity="Москва "
  155. if(dispatch_city==2):
  156. textcity="Казань "
  157. if(dispatch_city==3):
  158. textcity="Киев "
  159. if(dispatch_city==4):
  160. textcity="Минск "
  161. butdispatchcity_text_city = Label(window2)
  162. butdispatchcity_text_city.place(x=70, y=300)
  163. butdispatchcity_text_city.configure(font = "Arial, 13", fg = "black", text=textcity)
  164. ##################################################################
  165.  
  166. ###########################---ДАТА---#######################################
  167. def butdata_click():
  168. global trip_date
  169. trip_date = listbox3.curselection()[0]+1
  170. if(trip_date==1):
  171. textcity3="30.05.2019 "
  172. if(trip_date==2):
  173. textcity3="02.06.2019 "
  174. butdata_text_city = Label(window2)
  175. butdata_text_city.place(x=50, y=400)
  176. butdata_text_city.configure(font = "Arial, 13", fg = "black", text=textcity3)
  177. ##################################################################
  178.  
  179.  
  180. ###########################---МЕСТО НАЗНАЧЕНИЯ---#######################################
  181. def butdestinationcity_click():
  182. global destination_city
  183. destination_city = listbox2.curselection()[0]+1
  184. if(destination_city==1):
  185. textcity2="Москва "
  186. if(destination_city==2):
  187. textcity2="Казань "
  188. if(destination_city==3):
  189. textcity2="Киев "
  190. if(destination_city==4):
  191. textcity2="Минск "
  192. butdestinationcity_text_city = Label(window2)
  193. butdestinationcity_text_city.place(x=50, y=350)
  194. butdestinationcity_text_city.configure(font = "Arial, 13", fg = "black", text=textcity2)
  195. ##################################################################
  196.  
  197.  
  198. ###############################---МЕСТО ОТПРАВЛЕНИЯ---###################################################
  199. textvibormestao = Label(window2, text = "Откуда: ", bg="#00c3ff")
  200. textvibormestao.place(relx = 0, rely = 0.220)
  201. textvibormestao.configure(font = "Arial, 13", fg = "black")
  202. butdispatchcity=Button(window2, text = "Окей", command = butdispatchcity_click, width=11, bg ="#00c3ff")
  203. butdispatchcity.place(relx = 0, rely = 0.450)
  204. butdispatchcity_text = Label(window2, text = "Откуда: ")
  205. butdispatchcity_text.place(x=0, y=300)
  206. butdispatchcity_text.configure(font = "Arial, 13", fg = "black")
  207. ############################################################################################
  208.  
  209. ###############################--ДАТА--###################################################
  210. textdata = Label(window2, text = "Дата: ", bg="#00c3ff")
  211. textdata.place(relx = 0.36, rely = 0.220)
  212. textdata.configure(font = "Arial, 13", fg = "black")
  213. butdata=Button(window2, text = "Окей", command = butdata_click, width=11, bg ="#00c3ff")
  214. butdata.place(relx = 0.36, rely = 0.450)
  215. butdata_text = Label(window2, text = "Дата: ")
  216. butdata_text.place(x=0, y=400)
  217. butdata_text.configure(font = "Arial, 13", fg = "black")
  218. ############################################################################################
  219.  
  220. ###############################---МЕСТО НАЗНАЧЕНИЯ---###################################################
  221. textvibormestan = Label(window2, text = "Куда: ",bg="#00c3ff")
  222. textvibormestan.place(relx = 0.75, rely = 0.220)
  223. textvibormestan.configure(font = "Arial, 13", fg = "black")
  224. butdestinationcity=Button(window2, text = "Окей", command = butdestinationcity_click, width=11, bg ="#00c3ff")
  225. butdestinationcity.place(x=263, y=200)
  226. butdestinationcity_text = Label(window2, text = "Куда: ")
  227. butdestinationcity_text.place(x=0, y=350)
  228. butdestinationcity_text.configure(font = "Arial, 13", fg = "black")
  229. ############################################################################################
  230.  
  231. #################################---ПРОЧЕЕ---###############################################
  232. text = Label(window2, text = " Заказ железнодорожных билетов ", bg="#00c3ff",justify=CENTER)
  233. text.configure(font = "Arial, 13", fg = "black")
  234. text.pack()
  235. listbox1=Listbox(window2, height=4,width=15,selectmode=SINGLE, bg="#00c3ff", selectbackground="#006da3")
  236. listbox1.place(relx = -0.005, rely = 0.268)
  237. list1=[u"Москва", u"Казань", u"Киев", u"Минск"]
  238. for i in list1:
  239. listbox1.insert(END,i)
  240. listbox2=Listbox(window2, height=4,width=15,selectmode=SINGLE,bg="#00c3ff", selectbackground="#006da3")
  241. listbox2.place(relx = 0.75, rely = 0.268)
  242. list2=[u"Москва", u"Казань", u"Киев", u"Минск"]
  243. for i in list2:
  244. listbox2.insert(END,i)
  245. listbox3=Listbox(window2, height=2,width=15,selectmode=SINGLE, bg="#00c3ff", selectbackground="#006da3")
  246. listbox3.place(relx = 0.36, rely = 0.268)
  247. list3=[u"30.05.2019", u"02.06.2019"]
  248. for i in list3:
  249. listbox3.insert(END,i)
  250.  
  251. def proverka():
  252. if(trip_date==0):
  253. exception = mb.showerror(title="Ошибка", message="Выбор даты является обязательным")
  254. if(dispatch_city==destination_city):
  255. exception = mb.showerror(title="Ошибка", message="Пункты отправления и прибытия должны различаться")
  256. if((dispatch_city!=destination_city)and(trip_date!=0)):
  257. window2.destroy()
  258. form3()
  259.  
  260. buttransition1=Button(window2, text = "Подтвердить", command = proverka, width=15, height=2, font=("Arial, 10"), bg ="#00c3ff")
  261. buttransition1.place(x=210, y=400)
  262.  
  263.  
  264. ###################---ФОРМА 1---############################################
  265. window = Tk()
  266. window.title("Форма1")
  267. window.geometry("350x300")
  268. window.resizable(False, False)
  269. booking_text = Label(window, text = "Здравствуйте, на нашем портале\n вы можете осуществить покупку билета", justify=CENTER)
  270. booking_text.configure(font = "Arial, 13", fg = "black")
  271. booking_text.pack()
  272. butappend=Button(window, text = "Купить билет", command = form4, justify=CENTER)
  273. butappend.pack()
  274. window.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement