Last active
May 22, 2023 16:35
-
-
Save seagalputra/a4adabb15d683337b0b4ccf29130e024 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from tkinter import * | |
from PIL import ImageTk | |
class Signup(Frame): | |
def __init__(self, parent, controller, sqliteConnection): | |
Frame.__init__(self, parent) | |
self.controller = controller | |
self.sqliteConnection = sqliteConnection | |
background = ImageTk.PhotoImage(file="img//home_1.png") | |
bgLabel=Label(self,image=background) | |
bgLabel.grid() | |
frame=Frame(self,bg="#86BEE1") | |
frame.place(x=300,y=165) | |
#,fg="white" | |
heading = Label(frame,text="LOGIN USER",font=("Microsoft Yahei UI Light",16,"bold"),bg="#f5f5dc") | |
heading.grid(row=0,column=0,padx=10,pady=10) | |
emailLabel=Label(frame,text="Email",font=("Microsoft Yahei UI Light",10,"bold"),bg="#f5f5dc") | |
emailLabel.grid(row=1,column=0,sticky="w",padx=25) | |
emailEntry=Entry(frame,width=26,font=("Microsoft Yahei UI Light",10,"bold"),bg="white") | |
emailEntry.grid(row=2,column=0,sticky="w",padx=25) | |
usernameLabel=Label(frame,text="Username",font=("Microsoft Yahei UI Light",10,"bold"),bg="#f5f5dc") | |
usernameLabel.grid(row=3,column=0,sticky="w",padx=25) | |
# ,pady=(10,0) | |
usernameEntry=Entry(frame,width=26,font=("Microsoft Yahei UI Light",10,"bold"),bg="white") | |
usernameEntry.grid(row=4,column=0,sticky="w",padx=25) | |
passwordLabel=Label(frame,text="Password",font=("Microsoft Yahei UI Light",10,"bold"),bg="#f5f5dc") | |
passwordLabel.grid(row=5,column=0,sticky="w",padx=25) | |
passwordEntry=Entry(frame,width=26,font=("Microsoft Yahei UI Light",10,"bold"),bg="white") | |
passwordEntry.grid(row=6,column=0,sticky="w",padx=25) | |
termsandconditions=Checkbutton(frame,text="I agree to the Terms & Conditions",font=("Microsoft Yahei UI Light",8,"bold"),bg="#f5f5dc",activebackground="#86BEE1",cursor="hand2") | |
termsandconditions.grid(row=9,column=0,pady=9) | |
signupButton=Button(frame,text="Login",font=("Open Sans",15,"bold"),bd=0,bg="white",activebackground="white",activeforeground="#f5f5dc",width=17,command=lambda: login(usernameEntry=usernameEntry, passwordEntry=passwordEntry, controller=controller)) | |
signupButton.grid(row=10,column=0,pady=2) | |
# alreadyaccount=Label(frame,text="Login as admin",font=("Open Sans","9","bold"),bg="#f5f5dc") | |
# alreadyaccount.grid(row=11,column=0,sticky="w",padx=25,pady=10) | |
loginButton=Button(frame,text="Kembali",font=("Open Sans",9,"bold underline"),bg="#f5f5dc",fg="blue",bd=0,cursor="hand2",activebackground="#f5f5dc",activeforeground="blue",command=lambda:controller.show_frame('Login')) | |
loginButton.grid(row=11,column=0) | |
def login(self, usernameEntry, passwordEntry, controller): | |
print("Username: " + usernameEntry.get() + ", Password: " + passwordEntry.get()) | |
username = usernameEntry.get() | |
password = passwordEntry.get() | |
# query = "SELECT * FROM user WHERE username = ?" | |
query = "INSERT INTO ielts (nama, kelas, tanggal) VALUES (?, ?, ?)" | |
# parameter = (username) | |
parameter = (nama, kelas, tanggal) | |
cursor = self.sqliteConnection.cursor() | |
cursor.execute(query, parameter) | |
# record = cursor.fetchAll() | |
cursor.commit() | |
print("User => " + record) | |
# cek jika user punya password yg sama dengan inputannya | |
if record["password"] == password: | |
# print("password anda benar") | |
controller.show_frame('MainMenu') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# from tkinter import * | |
# from datetime import date | |
# from tkinter import filedialog | |
# from tkinter import messagebox | |
# from PIL import Image, ImageTk | |
# import os | |
# from tkinter.ttk import Combobox | |
# import openpyxl, xlrd | |
# from openpyxl import Workbook | |
# import pathlib | |
# background="#06283D" | |
# framebg = "#EDEDED" | |
# framefg = "#06283D" | |
# root = Tk() | |
# root.title("Student Registration System") | |
# root.geometry("1250x700+210+100") | |
# root.config(bg=background) | |
# root.mainloop() | |
# from tkinter import * | |
# from tkinter import font as tkfont | |
# from login import * | |
# from loginuser import * | |
# from loginadmin import * | |
# from menuuser import * | |
# from identitas import * | |
# from penyewaan import * | |
# class AplikasiRentalMobil(Tk): | |
# def _init_(self, *args, **kwargs): | |
# Tk._init_(self, *args, **kwargs) | |
# self.title("Aplikasi Rental Mobil") | |
# self.title_font = tkfont.Font(family='Helvetica', size=18, weight="bold", slant="italic") | |
# # self.background() | |
# container = Frame(self) | |
# container.pack(side = "top", fill = "both", expand = True) | |
# container.grid_rowconfigure(0, weight = 1) | |
# container.grid_columnconfigure(0, weight = 1) | |
# self.frames = {} | |
# for F in [Login,Signup,LoginAdmin,Identitas,SewaMobil]: | |
# page_name = F.__name__ | |
# frame = F(parent=container, controller=self) | |
# self.frames[page_name] = frame | |
# frame.grid(row = 0, column = 0, sticky ="nsew") | |
# self.show_frame("Login") | |
# def show_frame(self, page): | |
# frame = self.frames[page] | |
# frame.tkraise() | |
# app = AplikasiRentalMobil() | |
# app.mainloop() | |
# # from tkinter import * | |
# # from datetime import date | |
# # from tkinter import filedialog | |
# # from tkinter import messagebox | |
# # from PIL import Image, ImageTk | |
# # import os | |
# # from tkinter.ttk import Combobox | |
# # import openpyxl, xlrd | |
# # from openpyxl import Workbook | |
# # import pathlib | |
# # background="#06283D" | |
# # framebg = "#EDEDED" | |
# # framefg = "#06283D" | |
# # root = Tk() | |
# # root.title("Student Registration System") | |
# # root.geometry("1250x700+210+100") | |
# # root.config(bg=background) | |
# # root.mainloop() | |
from tkinter import * | |
from tkinter import font as tkfont | |
from login import * | |
from loginuser import * | |
from identitas import * | |
from loginadmin import* | |
from menuuser import * | |
from penyewaan import * | |
import sqlite3 | |
class AplikasiRentalMobil(Tk): | |
def __init__(self, *args, **kwargs): | |
Tk.__init__(self, *args, **kwargs) | |
sqliteConnection = sqlite3.connect("AplikasiRentalMobil.db") | |
self.title("Aplikasi Rental Mobil") | |
self.title_font = tkfont.Font(family='Helvetica', size=18, weight="bold", slant="italic") | |
container = Frame(self) | |
container.pack(side = "top", fill = "both", expand = True) | |
container.grid_rowconfigure(0, weight = 1) | |
container.grid_columnconfigure(0, weight = 1) | |
self.frames = {} | |
for F in [Login,Signup]: | |
page_name = F.__name__ | |
frame = F(parent=container, controller=self, sqliteConnection=sqliteConnection) | |
self.frames[page_name] = frame | |
frame.grid(row = 0, column = 0, sticky ="nsew") | |
self.show_frame("Signup") | |
# self.show_frame('Identitas Customer') | |
def show_frame(self, page): | |
frame = self.frames[page] | |
frame.tkraise() | |
app = AplikasiRentalMobil() | |
app.mainloop() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment