Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from tkinter import *
- import sqlite3
- import time
- #import RPi.GPIO as GPIO
- import tkinter.font
- db = sqlite3.connect('Automat111.db')
- class FullScreenApp(object):
- def __init__(self, master, **kwargs):
- self.master=master
- pad=3
- self._geom = '200x200+0+0'
- master.geometry("{0}x{1}+0+0".format(master.winfo_screenwidth()-pad,master.winfo_screenheight()-pad))
- master.bind('<Escape>',self.toggle_geom)
- self.state = False
- self.master.bind("<F11>", self.toggle_fullscreen)
- self.master.bind("<Escape>", self.end_fullscreen)
- def toggle_geom(self, event):
- geom = self.master.winfo_geometry()
- print(geom,self._geom)
- self.geom = geom
- def toggle_fullscreen(self, event = None):
- self.state = not self.state
- self.master.attributes("-fullscreen", self.state)
- return "break"
- def end_fullscreen(self, event = None):
- self.state = False
- self.master.attributes("-fullscreen", False)
- return "brak"
- root=Tk()
- app=FullScreenApp(root)
- root.configure(background="teal")
- textin1 = StringVar()
- textin2 = StringVar()
- textin3 = StringVar()
- textin4 = StringVar()
- textin5 = StringVar()
- def Rejestracja():
- window1 = Tk()
- #windowWidth = window1.winfo.reqwidth()
- # windowHeight = window1.winfo_reqheight()
- #positionRight = int(root.winfo_screenwidth()/2 - windowWidth/2)
- # positionDown = int(root.winfo_screenheight()/2 - windowHeight/2)
- window1.title('Rejestracja')
- window1.geometry("500x500")
- # window1.geometry("400x400+{}+{}".format(positionRight, positionDown))
- lab=Label(window1,text='Login:',font=('none 13 bold'))
- lab.place(x=0,y=0)
- ent_Login=Entry(window1,width=20,font=('none 13 bold'),textvar=textin1)
- ent_Login.place(x=80,y=0)
- lab1=Label(window1,text='Haslo:',font=('none 13 bold'))
- lab1.place(x=0,y=40)
- ent_Haslo=Entry(window1,width=20,font=('none 13 bold'),textvar=textin2)
- ent_Haslo.place(x=80,y=40)
- lab2=Label(window1,text='Wiek:',font=('none 13 bold'))
- lab2.place(x=0,y=80)
- ent_Wiek=Entry(window1,width=20,font=('none 13 bold'),textvar=textin3)
- ent_Wiek.place(x=80,y=80)
- lab3=Label(window1,text='Plec:',font=('none 13 bold'))
- lab3.place(x=0,y=120)
- ent_Plec=Entry(window1,width=20,font=('none 13 bold'),textvar=textin4)
- ent_Plec.place(x=80,y=120)
- lab4=Label(window1,text='Waga:',font=('none 13 bold'))
- lab4.place(x=0,y=160)
- ent_Waga=Entry(window1,width=20,font=('none 13 bold'),textvar=textin5)
- ent_Waga.place(x=80,y=160)
- but=Button(window1,padx=2,pady=2,text='Submit',command=insert,font=('none 13 bold'))
- but.place(x=60,y=190)
- ##SHOW DO WYJEBANIA BEDZIE (TERAZ JEST TYLKO DO TESTOW)
- res=Button(window1,padx=2,pady=2,text='Show',command=show,font=('none 13 bold'))
- res.place(x=160,y=190)
- window1.mainloop()
- Btn1 = Button(text='Rejestracja',font=('none 13 bold'), command=Rejestracja)
- Btn1.place(x=100,y=50)
- Factor1=0.7
- Factor2=0.6
- def insert():
- Login = textin1.get()
- Haslo = textin2.get()
- Wiek = textin3.get()
- Plec = textin4.get()
- Waga = textin5.get()
- conn = sqlite3.connect('Automat111.db')
- print(Login,Haslo,Wiek,Plec,Waga)
- with conn:
- cursor = conn.cursor()
- cursor.execute('INSERT INTO Uzytkownicy(Login, Haslo, Wiek, Plec, Waga) VALUES (?,?,?,?,?)',(Login, Haslo, Wiek, Plec, Waga))
- db.close()
- def show():
- connt = sqlite3.connect('Automat111.db')
- cursor = connt.cursor()
- cursor.execute('SELECT * FROM Uzytkownicy')
- for row in cursor.fetchall():
- print(row)
- root.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement