FICHERO DE BASE DE DATOS
Enviado por Diego Marin • 7 de Junio de 2020 • Apuntes • 1.281 Palabras (6 Páginas) • 150 Visitas
from tkinter import *
import tkinter as tK
import tkinter as ttk
from tkinter import messagebox, Entry
import pymysql
def leer():
conexion = pymysql.connect(host="localhost",
user="root",
passwd="",
database="pacientes")
cursor = conexion.cursor()
consulta = "SELECT * FROM pacientes;"
cursor.execute(consulta)
filas = cursor.fetchall()
print("Registros de citas:")
for fila in filas:
print(fila[0], "||", fila[1], "||", fila[2], "||", fila[3], "||", fila[4])
conexion.commit()
conexion.close()
# crear el formulario
ventana = Tk()
ventana.geometry("950x850")
ventana.title("Formulario agendar cita")
ventana.resizable(False, False)
ventana.config(background="#69B9EB")
main_title = Label(text="ASIGNACION", font=("Cambria", 14), bg="#FAE904", fg="black", width="500",
height="1")
main_title.pack()
main_title2 = Label(text="DE", font=("Cambria", 14), bg="#3B29F8", fg="black", width="500",
height="1")
main_title2.pack()
main_title3 = Label(text="CITAS", font=("Cambria", 14), bg="#FC001E", fg="black", width="500",
height="1")
main_title3.pack()
# definicion de los label
docu_label = Label(text="DOCUMENTO DEL PACIENTE:", bg="#FFEEDD")
docu_label.place(x=400, y=130)
nbene_label = Label(text="NOMBRE DEL PACIENTE:", bg="#FFEEDD")
nbene_label.place(x=410, y=230)
nacu_label = Label(text="CITA DE:", bg="#FFEEDD")
nacu_label.place(x=450, y=330)
dacu_label = Label(text="FECHA DE LA CITA:", bg="#FFEEDD")
dacu_label.place(x=420, y=440)
hor_label = Label(text="HORA DE LA CITA:", bg="#FFEEDD")
hor_label.place(x=420, y=540)
# variables y formatos en entrada
docu = StringVar()
npac = StringVar()
cita = StringVar()
fecha = StringVar()
hor = StringVar()
docu_entry = Entry(textvariable=docu, width="40")
npac_entry = Entry(textvariable=npac, width="40")
cita_entry = Entry(textvariable=cita, width="40")
fec_entry = Entry(textvariable=fecha, width="40")
hor_entry = Entry(textvariable=hor, width="40")
docu_entry.place(x=360, y=180)
npac_entry.place(x=360, y=280)
cita_entry.place(x=360, y=380)
fec_entry.place(x=360, y=480)
hor_entry.place(x=360, y=580)
docu1 = StringVar()
npac1 = StringVar()
cita1 = StringVar()
fecha1 = StringVar()
hor1 = StringVar()
docu2 = StringVar()
def ventana2():
win = tK.Toplevel()
win.geometry('800x800')
win.title("Formulario actualizar registro")
win.resizable(False, False)
win.config(background="#69B9EB")
e3 = Label(win, text="ACTUALIZACION DE REGISTROS", font=("Cambria", 14), bg="#69B9EB", fg="black", width="500",
height="1")
e3.pack()
submit_btn = Button(win, text="Registrar Cita", width="20", height="2", command=modif, bg="#DEDE11")
submit_btn.place(x=290, y=670)
docu_label1 = Label(win, text="DOCUMENTO DEL PACIENTE:", bg="#FFEEDD")
docu_label1.place(x=15, y=100)
no_mod = Label(win, text="*EXISTENTE, NO MODIFICABLE*", fg="red")
no_mod.place(x=410, y=100)
modi = Label(win, text="DATOS A MODIFICAR", font=("Cambria", 14), bg="#00FF00")
modi.place(x=300, y=200)
nbene_label1 = Label(win, text="NOMBRE DEL PACIENTE:", bg="#FFEEDD")
nbene_label1.place(x=180, y=280)
nacu_label1 = Label(win, text="CITA DE:", bg="#FFEEDD")
nacu_label1.place(x=180, y=380)
dacu_label1 = Label(win, text="FECHA DE LA CITA:", bg="#FFEEDD")
dacu_label1.place(x=180, y=490)
hor_label1 = Label(win, text="HORA DE LA CITA:", bg="#FFEEDD")
hor_label1.place(x=180, y=590)
docu1_entry = Entry(win, textvariable=docu1, width="30")
npac1_entry = Entry(win, textvariable=npac1, width="40")
cita1_entry = Entry(win, textvariable=cita1, width="40")
fecha1_entry = Entry(win, textvariable=fecha1, width="40")
hor1_entry = Entry(win, textvariable=hor1, width="40")
...