По какой-то причине определенная переменная more_universities не выполняется, и python не показывает никакой ошибки, так что на самом деле это вызывает у меня проблемы в тот момент, когда я пытаюсь продвинуть GUI дальше.
Этот код позже будет полезен для получения данных и записи файлов с ними (я еще не принимал это до сих пор)
#Importing all modules
import tkinter.font as font
from tkinter import ttk
import tkinter as tk
from PIL import ImageTk, Image
import os
#This is the text we want to display
def texto():
greets = ("Gracias por postularse " + str(Name) + "\n ")
contact1 = ("Lo contactaremos a su correo electronico: " + str(Email) + "\n ")
contact2 = ("En caso de no ser posible o no ver respuesta su numero de telefono: " + str(Phone) + " sera contactado \n ")
contact3 = ("Su salario deseado es: " + str(Salary) + " y sera tomado en consideracion \n ")
text = greets + contact1 + contact2 + contact3
return text
#Function created to active the text once the information is filled
def display_information():
#Displaying the text in this same window
window = tk.Tk()
window.title("Aplicacion sometida")
greet = tk.Label(window, text = "A quien corresponda: ")
greet.grid(row = 0, column = 0)
Result = tk.Label(window, text = texto())
Result.grid(row = 1 ,column = 1)
window.mainloop()
#Get values of the entries
def get_values():
#Strings
global Name
global Email
global Phone
global Salary
global ID
Name = String1.get()
Email = String2.get()
Phone = String3.get()
Salary = String4.get()
#Booleans
global licencia
global carnet
global universidad
global identificacion
licencia = boolean1.get()
carnet = boolean2.get()
universidad = boolean3.get()
identificacion = boolean4.get()
university()
#If university has been achieved
def university():
#If the person has university studies
if universidad == True:
#Creation of the window
master = tk.Tk()
master.title("Informacion Universitaria")
#Labels of the university
myfont = font.Font(size = 15)
Title = tk.Label(master, text = "LUNCHEVA S.A")
Title.config(fg = 'green')
Title['font'] = myfont
Title.grid(row = 0, column = 0)
greeting = tk.Label(master, text = "Por favor introduzca la informacion solicitada: ")
greeting.grid(row = 1, column = 1)
universidad2 = tk.Label(master, text = "Universidad a la cual asistio:")
universidad2.grid(row = 2, column = 1)
estudios = tk.Label(master, text = "Area en la cual realizo sus estudios:")
estudios.grid(row = 3, column = 1)
pais = tk.Label(master, text = "Pais en el cual realizo estos estudios:")
pais.grid(row = 4, column = 1)
mas = tk.Label(master, text = "En caso de poseer mas de un titulo universitario")
mas.grid(row = 5, column = 2)
mas2 = tk.Label(master, text = "Haga click a continuacion")
mas2.grid(row = 6, column = 2)
#String values for the entries
String_1 = tk.StringVar(master)
String_2 = tk.StringVar(master)
String_3 = tk.StringVar(master)
#Entries of the university
u1 = tk.Entry(master, textvariable = String_1, width = 30)
u1.grid(row = 2, column = 2)
u2 = tk.Entry(master, textvariable = String_2, width = 30)
u2.grid(row = 3, column = 2)
u3 = tk.Entry(master, textvariable = String_3, width = 30)
u3.grid(row = 4, column = 2)
#Boolean value for university
boolean_1 = tk.BooleanVar(master)
#Checkbuttons for the boolean value in university
#In case the subject has more than university title
titulo = tk.Checkbutton(master, text="Poseo mas de un titulo", variable = boolean_1)
titulo.grid(row = 7, column = 2)
#In order to obtain the information of this window
def get_values_university():
#Strings
global u1
global u2
global u3
u1 = String_1.get()
u2 = String_2.get()
u3 = String_3.get()
#Booleans
global titulo
titulo = boolean_1.get()
#Obtaining the information
get_values_university()
# Submit button
titulo_21 = tk.Button(master, text = "Agregar mas informacion", fg = 'green',activebackground = "green", activeforeground = "green", command= more_universities())
titulo_21.grid(row = 8, column = 2)
submit2 = tk.Button(master, text = "Enviar", fg = 'green',activebackground = "green", activeforeground = "green", command= get_values_university())
submit2.grid(row = 99, column = 99)
master.mainloop()
#To get the values of the university if it has been achieved
def more_universities():
if titulo == True:
#Destroying the previous window
master.destroy()
#Creation of the window
root = tk.Tk()
root.title("Informacion Universitaria")
#Labels of the university
myfont = font.Font(size = 15)
Title = tk.Label(root, text = "LUNCHEVA S.A")
Title.config(fg = 'green')
Title['font'] = myfont
Title.grid(row = 0, column = 0)
greetingg = tk.Label(root, text = "Por favor introduzca la informacion solicitada: ")
greetingg.grid(row = 1, column = 1)
universidad2g = tk.Label(root, text = "Universidad a la cual asistio:")
universidad2g.grid(row = 2, column = 1)
estudiosg = tk.Label(root, text = "Area en la cual realizo sus estudios:")
estudiosg.grid(row = 3, column = 1)
paisg = tk.Label(root, text = "Pais en el cual realizo estos estudios:")
paisg.grid(row = 4, column = 1)
masg = tk.Label(root, text = "En caso de poseer mas de un titulo universitario")
masg.grid(row = 5, column = 2)
mas2g = tk.Label(root, text = "Haga click a continuacion")
mas2g.grid(row = 6, column = 2)
saludo2 = tk.Label(root, text = "Segundo titulo universitario:")
saludo2.grid(row = 9, column = 0)
universidad3 = tk.Label(root, text = "Universidad a la cual asistio:")
universidad3.grid(row = 10, column = 1)
estudios2 = tk.Label(root, text = "Area en la cual realizo sus estudios:")
estudios2.grid(row = 11, column = 1)
pais2 = tk.Label(root, text = "Pais en el cual realizo estos estudios:")
pais2.grid(row = 12, column = 1)
#String values for the entries
String_4 = tk.StringVar(root)
String_5 = tk.StringVar(root)
String_6 = tk.StringVar(root)
#Entries of the university
u4 = tk.Entry(root, textvariable = String_1, width = 30)
u1.grid(row = 2, column = 2)
u5 = tk.Entry(root, textvariable = String_2, width = 30)
u2.grid(row = 3, column = 2)
u6 = tk.Entry(root, textvariable = String_3, width = 30)
u3.grid(row = 4, column = 2)
#Boolean value for university
boolean_2 = tk.BooleanVar(root)
#Checkbuttons for the boolean value in university
#In case the subject has more than university title
titulo_2 = tk.Checkbutton(root, text="Poseo mas de un titulo", variable = boolean_2)
titulo_2.grid(row = 7, column = 2)
# Submit button
titulo_3 = tk.Button(root, text = "Agregar mas informacion", fg = 'green',activebackground = "green", activeforeground = "green")
titulo_3.grid(row = 8, column = 2)
submit_button_2 = tk.Button(root, text = "Enviar", fg = 'green',activebackground = "green", activeforeground = "green")
submit_button_2.grid(row = 99, column = 99)
root.mainloop()
#Creating the window
top = tk.Tk()
#Title of the previous window
top.title("Formato de aplicacion")
#Labels of the window
myfont = font.Font(size = 15)
Title = tk.Label(top, text = "LUNCHEVA S.A")
Title.config(fg = 'green')
Title['font'] = myfont
Title.grid(row = 1, column = 0)
greeting = tk.Label(top, text = "Por favor introduzca la informacion solicitada: ")
greeting.grid(row = 1, column = 2)
name = tk.Label(top, text = "Nombre")
name.grid(row = 2, column = 1)
email = tk.Label(top, text = "Correo Electronico")
email.grid(row = 3, column = 1)
phone_number = tk.Label(top, text = "Numero celular")
phone_number.grid(row = 4, column = 1)
salary = tk.Label(top, text = "Salario deseado")
salary.grid(row = 5, column = 1)
Instruccion = tk.Label(top, text ="Por favor de click sobre aquella informacion verdadera:")
Instruccion.grid(row = 6, column = 1)
Instruccion2 = tk.Label(top, text ="Usted posee: ")
Instruccion2.grid(row = 7, column = 2)
#Image of the LOGO of Luncheva
path = "C:\\Users\Dell\\Pictures\\luncheva.jpg"
img = ImageTk.PhotoImage(Image.open(path))
panel = tk.Label(top, image = img)
panel.grid(row =0, column =0)
#Booleans for each checkbuttons
boolean1 = tk.BooleanVar(top)
boolean2 = tk.BooleanVar(top)
boolean3 = tk.BooleanVar(top)
boolean4 = tk.BooleanVar(top)
#Checkbuttons for yes or no information
licencia = tk.Checkbutton(top, text="Licencia de Conducir", variable = boolean1)
licencia.grid(row = 8, column = 2)
carnet = tk.Checkbutton(top, text="Carnet de manipulacion de alimentos", variable = boolean2)
carnet.grid(row = 9, column = 2)
universidad = tk.Checkbutton(top, text="Estudios universitarios", variable = boolean3)
universidad.grid(row = 10, column = 2)
identificacion = tk.Checkbutton(top, text="Identificacion vigente", variable = boolean4)
identificacion.grid(row = 11, column = 2)
#Strings of each entry
String1 = tk.StringVar(top)
String2 = tk.StringVar(top)
String3 = tk.StringVar(top)
String4 = tk.StringVar(top)
#Entries
e1 = tk.Entry(top, textvariable = String1, width = 30)
e1.grid(row = 2, column = 2)
e2 = tk.Entry(top, textvariable = String2, width = 30)
e2.grid(row = 3, column = 2)
e3 = tk.Entry(top, textvariable = String3, width = 30)
e3.grid(row = 4, column = 2)
e4 = tk.Entry(top, textvariable = String4, width = 30)
e4.grid(row = 5, column = 2)
#Button of the window
submit = tk.Button(top, text = "Enviar", fg = 'green',activebackground = "green", activeforeground = "green", command= get_values)
submit.grid(row = 99, column = 99)
#Executing the window
top.mainloop()