Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from tkinter import*
- import sqlite3
- import os
- from tkinter import *
- from tkinter import messagebox as mb
- conn = sqlite3.connect("mydatabase.db") # или :memory: чтобы сохранить в RAM
- cursor = conn.cursor()
- # Создание таблицы
- cursor.execute("""CREATE TABLE albums
- (title text, artist text, release_date text,
- publisher text, media_type text)
- """)
- trip_date=0
- kategori_ticket = 0
- mesto_ticket = 0
- persons_name = 0
- persons_surname = 0
- persons_Date_of_Birth = 0
- persons_pass_seria = 0
- persons_pass_number = 0
- persons_patronymic=0
- def form5():
- def data_validation():
- print("пока ничего")
- window5 = Tk()
- window5.title("Форма5")
- window5.geometry("350x450")
- window5.resizable(False, False)
- form5_text = Label(window5, text = "Распечатка билета", justify=CENTER)
- form5_text.configure(font = "Arial, 15", fg = "black")
- form5_text.pack()
- name_text= Label(window5, text = "Имя:")
- name_text.configure(font = "Arial, 10", fg = "black")
- name_text.place (y=50)
- surname_text= Label(window5, text = "Фамилия:")
- surname_text.configure(font = "Arial, 10", fg = "black")
- surname_text.place (y=80)
- patronymic_text= Label(window5, text = "Отчество:")
- patronymic_text.configure(font = "Arial, 10", fg = "black")
- patronymic_text.place (y=110)
- Date_of_Birth_text= Label(window5, text = "Дата рождения:")
- Date_of_Birth_text.configure(font = "Arial, 10", fg = "black")
- Date_of_Birth_text.place (y=140)
- pass_text = Label(window5, text = "Паспорт (серия -> номер):")
- pass_text.configure(font = "Arial, 10", fg = "black")
- pass_text.place (y=170)
- ############################################################################
- persons_name_text_form5 = Label(window5)
- persons_name_text_form5.place(x= 30, y=50)
- persons_name_text_form5.configure(font = "Arial, 10", fg = "black", text=persons_name)
- persons_surname_text_form5 = Label(window5)
- persons_surname_text_form5.place(x= 60, y=80)
- persons_surname_text_form5.configure(font = "Arial, 10", fg = "black", text=persons_surname)
- persons_patronymic_text_form5 = Label(window5)
- persons_patronymic_text_form5.place(x= 60, y=110)
- persons_patronymic_text_form5.configure(font = "Arial, 10", fg = "black", text=persons_patronymic)
- persons_Date_of_Birth_text_form5 = Label(window5)
- persons_Date_of_Birth_text_form5.place(x= 100, y=140)
- persons_Date_of_Birth_text_form5.configure(font = "Arial, 10", fg = "black", text=persons_Date_of_Birth)
- persons_pass_seria_form5 = Label(window5)
- persons_pass_seria_form5.place(x= 160, y=170)
- persons_pass_seria_form5.configure(font = "Arial, 10", fg = "black", text=persons_pass_seria)
- persons_number_seria_form5 = Label(window5)
- persons_number_seria_form5.place(x= 210, y=170)
- persons_number_seria_form5.configure(font = "Arial, 10", fg = "black", text=persons_pass_number)
- ############################################################################
- buttransition3=Button(window5, text = "Подтвердить", command = data_validation, width=15, height=2, font=("Arial, 10"), bg ="#00c3ff")
- buttransition3.place(x=210, y=400)
- def form4():
- window4 = Tk()
- window4.title("Форма4")
- window4.geometry("350x450")
- window4.resizable(False, False)
- form4_text = Label(window4, text = "Ввод личных данных", justify=CENTER)
- form4_text.configure(font = "Arial, 15", fg = "black")
- form4_text.pack()
- name_text= Label(window4, text = "Имя:")
- name_text.configure(font = "Arial, 10", fg = "black")
- name_text.place (y=50)
- surname_text= Label(window4, text = "Фамилия:")
- surname_text.configure(font = "Arial, 10", fg = "black")
- surname_text.place (y=80)
- patronymic_text= Label(window4, text = "Отчество:")
- patronymic_text.configure(font = "Arial, 10", fg = "black")
- patronymic_text.place (y=110)
- Date_of_Birth_text= Label(window4, text = "Дата рождения:")
- Date_of_Birth_text.configure(font = "Arial, 10", fg = "black")
- Date_of_Birth_text.place (y=140)
- pass_text = Label(window4, text = "Паспорт (серия -> номер):")
- pass_text.configure(font = "Arial, 10", fg = "black")
- pass_text.place (y=170)
- textboxname = Entry(window4, width=20)
- textboxname.focus_set()
- textboxname.place(x= 100, y=50)
- textboxsurname = Entry(window4, width=20)
- textboxsurname.focus_set()
- textboxsurname.place(x= 100, y=80)
- textboxpatronymic = Entry(window4, width=20)
- textboxpatronymic.focus_set()
- textboxpatronymic.place(x= 100, y=110)
- textboxDate_of_Birth = Entry(window4, width=20)
- textboxDate_of_Birth.focus_set()
- textboxDate_of_Birth.place(x= 100, y=140)
- textboxpassseria = Entry(window4, width=6)
- textboxpassseria.focus_set()
- textboxpassseria.place(x= 170, y=170)
- textboxpassnumber = Entry(window4, width=4)
- textboxpassnumber.focus_set()
- textboxpassnumber.place(x= 220, y=170)
- def data_transmission():
- global persons_name; global persons_surname; global persons_Date_of_Birth; global persons_pass_seria; global persons_pass_number; global persons_patronymic;
- persons_name = textboxname.get()
- persons_surname = textboxsurname.get()
- persons_patronymic = textboxpatronymic.get()
- persons_Date_of_Birth = textboxDate_of_Birth.get()
- persons_pass_seria = textboxpassseria.get()
- persons_pass_number = textboxpassnumber.get()
- window4.destroy()
- form5()
- buttransition2=Button(window4, text = "Подтвердить", command = data_transmission, width=15, height=2, font=("Arial, 10"), bg ="#00c3ff")
- buttransition2.place(x=210, y=400)
- def form3():
- def proverka2():
- if(mesto_ticket==0):
- exception = mb.showerror(title="Ошибка", message="Выбор места является обязательным")
- if(kategori_ticket==0):
- exception = mb.showerror(title="Ошибка", message="Выбор категории места является обязательным")
- if(kategori_ticket!=0 and mesto_ticket!=0):
- window3.destroy()
- form4()
- ###########################---Категория билета---#######################################
- def kategori_click():
- global kategori_ticket
- kategori_ticket = listboxkategori.curselection()[0]+1
- if(kategori_ticket==1):
- textkategori1="Обычный "
- if(kategori_ticket==2):
- textkategori1 = "Детский "
- if(kategori_ticket==3):
- textkategori1 ="Льготный "
- kategori_text_2 = Label(window3)
- kategori_text_2.place(x=150, y=300)
- kategori_text_2.configure(font = "Arial, 13", fg = "black", text=textkategori1)
- ##################################################################
- ###########################---МЕСТО билета---#######################################
- def mesto_click():
- global mesto_ticket
- mesto_ticket = listboxmesto.curselection()[0]+1
- if(mesto_ticket==1):
- textmesto1="Верхнее "
- if(mesto_ticket==2):
- textmesto1="Нижнее "
- if(mesto_ticket==3):
- textmesto1="Верхнее-боковое "
- if(mesto_ticket==4):
- textmesto1="Нижнее-боковое "
- mesto_text_2 = Label(window3)
- mesto_text_2.place(x=60, y=350)
- mesto_text_2.configure(font = "Arial, 13", fg = "black", text=textmesto1)
- ##################################################################
- window3 = Tk()
- window3.title("Форма3")
- window3.geometry("350x450")
- window3.resizable(False, False)
- buttransition2=Button(window3, text = "Подтвердить", command = proverka2, width=15, height=2, font=("Arial, 10"), bg ="#00c3ff")
- buttransition2.place(x=210, y=400)
- form3_text = Label(window3, text = " Выбор категории билета и места ", bg="#00c3ff",justify=CENTER)
- form3_text.configure(font = "Arial, 15", fg = "black")
- form3_text.pack()
- ###############################---КАТЕГОРИЯ БИЛЕТА---###################################################
- textkategoti = Label(window3, text = "Категория билета:", bg="#00c3ff")
- textkategoti.place(relx = 0, rely = 0.220)
- textkategoti.configure(font = "Arial, 13", fg = "black")
- butkategori=Button(window3, text = "Окей", command = kategori_click, width=11, bg ="#00c3ff")
- butkategori.place(relx = 0, rely = 0.395)
- butkategori_text = Label(window3, text = "Категория билета: ")
- butkategori_text.place(x=0, y=300)
- butkategori_text.configure(font = "Arial, 13", fg = "black")
- listboxkategori=Listbox(window3, height=3,width=15,selectmode=SINGLE, bg="#00c3ff", selectbackground="#006da3")
- listboxkategori.place(relx = -0.005, rely = 0.275)
- listkategori=[u"Обычный", u"Детский", u"Льготный"]
- for i in listkategori:
- listboxkategori.insert(END,i)
- ############################################################################################
- ###############################---МЕСТО---###################################################
- textmesto = Label(window3, text = "Место: ", bg="#00c3ff")
- textmesto.place(relx = 0.7, rely = 0.220)
- textmesto.configure(font = "Arial, 13", fg = "black")
- butmesto=Button(window3, text = "Окей", command = mesto_click, width=11, bg ="#00c3ff")
- butmesto.place(relx = 0.7, rely = 0.43)
- butmesto_text = Label(window3, text = "Место: ")
- butmesto_text.place(x=0, y=350)
- butmesto_text.configure(font = "Arial, 13", fg = "black")
- listboxmesto=Listbox(window3, height=4,width=17,selectmode=SINGLE, bg="#00c3ff", selectbackground="#006da3")
- listboxmesto.place(relx = 0.7, rely = 0.275)
- listmesto=[u"Верхнее", u"Нижнее", u"Верхнее-боковое", u"Нижнее-боковое"]
- for i in listmesto:
- listboxmesto.insert(END,i)
- ############################################################################################
- def form2(): # ================= ФОРМА 2
- window.destroy()
- window2 = Tk()
- window2.title("Форма2")
- window2.geometry("350x450")
- window2.resizable(False, False)
- ###########################---МЕСТО ОТПРАВКИ---#######################################
- def butdispatchcity_click():
- global dispatch_city
- dispatch_city = listbox1.curselection()[0]+1
- if(dispatch_city==1):
- textcity="Москва "
- if(dispatch_city==2):
- textcity="Казань "
- if(dispatch_city==3):
- textcity="Киев "
- if(dispatch_city==4):
- textcity="Минск "
- butdispatchcity_text_city = Label(window2)
- butdispatchcity_text_city.place(x=70, y=300)
- butdispatchcity_text_city.configure(font = "Arial, 13", fg = "black", text=textcity)
- ##################################################################
- ###########################---ДАТА---#######################################
- def butdata_click():
- global trip_date
- trip_date = listbox3.curselection()[0]+1
- if(trip_date==1):
- textcity3="30.05.2019 "
- if(trip_date==2):
- textcity3="02.06.2019 "
- butdata_text_city = Label(window2)
- butdata_text_city.place(x=50, y=400)
- butdata_text_city.configure(font = "Arial, 13", fg = "black", text=textcity3)
- ##################################################################
- ###########################---МЕСТО НАЗНАЧЕНИЯ---#######################################
- def butdestinationcity_click():
- global destination_city
- destination_city = listbox2.curselection()[0]+1
- if(destination_city==1):
- textcity2="Москва "
- if(destination_city==2):
- textcity2="Казань "
- if(destination_city==3):
- textcity2="Киев "
- if(destination_city==4):
- textcity2="Минск "
- butdestinationcity_text_city = Label(window2)
- butdestinationcity_text_city.place(x=50, y=350)
- butdestinationcity_text_city.configure(font = "Arial, 13", fg = "black", text=textcity2)
- ##################################################################
- ###############################---МЕСТО ОТПРАВЛЕНИЯ---###################################################
- textvibormestao = Label(window2, text = "Откуда: ", bg="#00c3ff")
- textvibormestao.place(relx = 0, rely = 0.220)
- textvibormestao.configure(font = "Arial, 13", fg = "black")
- butdispatchcity=Button(window2, text = "Окей", command = butdispatchcity_click, width=11, bg ="#00c3ff")
- butdispatchcity.place(relx = 0, rely = 0.450)
- butdispatchcity_text = Label(window2, text = "Откуда: ")
- butdispatchcity_text.place(x=0, y=300)
- butdispatchcity_text.configure(font = "Arial, 13", fg = "black")
- ############################################################################################
- ###############################--ДАТА--###################################################
- textdata = Label(window2, text = "Дата: ", bg="#00c3ff")
- textdata.place(relx = 0.36, rely = 0.220)
- textdata.configure(font = "Arial, 13", fg = "black")
- butdata=Button(window2, text = "Окей", command = butdata_click, width=11, bg ="#00c3ff")
- butdata.place(relx = 0.36, rely = 0.450)
- butdata_text = Label(window2, text = "Дата: ")
- butdata_text.place(x=0, y=400)
- butdata_text.configure(font = "Arial, 13", fg = "black")
- ############################################################################################
- ###############################---МЕСТО НАЗНАЧЕНИЯ---###################################################
- textvibormestan = Label(window2, text = "Куда: ",bg="#00c3ff")
- textvibormestan.place(relx = 0.75, rely = 0.220)
- textvibormestan.configure(font = "Arial, 13", fg = "black")
- butdestinationcity=Button(window2, text = "Окей", command = butdestinationcity_click, width=11, bg ="#00c3ff")
- butdestinationcity.place(x=263, y=200)
- butdestinationcity_text = Label(window2, text = "Куда: ")
- butdestinationcity_text.place(x=0, y=350)
- butdestinationcity_text.configure(font = "Arial, 13", fg = "black")
- ############################################################################################
- #################################---ПРОЧЕЕ---###############################################
- text = Label(window2, text = " Заказ железнодорожных билетов ", bg="#00c3ff",justify=CENTER)
- text.configure(font = "Arial, 13", fg = "black")
- text.pack()
- listbox1=Listbox(window2, height=4,width=15,selectmode=SINGLE, bg="#00c3ff", selectbackground="#006da3")
- listbox1.place(relx = -0.005, rely = 0.268)
- list1=[u"Москва", u"Казань", u"Киев", u"Минск"]
- for i in list1:
- listbox1.insert(END,i)
- listbox2=Listbox(window2, height=4,width=15,selectmode=SINGLE,bg="#00c3ff", selectbackground="#006da3")
- listbox2.place(relx = 0.75, rely = 0.268)
- list2=[u"Москва", u"Казань", u"Киев", u"Минск"]
- for i in list2:
- listbox2.insert(END,i)
- listbox3=Listbox(window2, height=2,width=15,selectmode=SINGLE, bg="#00c3ff", selectbackground="#006da3")
- listbox3.place(relx = 0.36, rely = 0.268)
- list3=[u"30.05.2019", u"02.06.2019"]
- for i in list3:
- listbox3.insert(END,i)
- def proverka():
- if(trip_date==0):
- exception = mb.showerror(title="Ошибка", message="Выбор даты является обязательным")
- if(dispatch_city==destination_city):
- exception = mb.showerror(title="Ошибка", message="Пункты отправления и прибытия должны различаться")
- if((dispatch_city!=destination_city)and(trip_date!=0)):
- window2.destroy()
- form3()
- buttransition1=Button(window2, text = "Подтвердить", command = proverka, width=15, height=2, font=("Arial, 10"), bg ="#00c3ff")
- buttransition1.place(x=210, y=400)
- ###################---ФОРМА 1---############################################
- window = Tk()
- window.title("Форма1")
- window.geometry("350x300")
- window.resizable(False, False)
- booking_text = Label(window, text = "Здравствуйте, на нашем портале\n вы можете осуществить покупку билета", justify=CENTER)
- booking_text.configure(font = "Arial, 13", fg = "black")
- booking_text.pack()
- butappend=Button(window, text = "Купить билет", command = form2, justify=CENTER)
- butappend.pack()
- window.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement