loadingscreen/loading.py
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | #loadingscreen/loading.py from tkinter import * from tkinter.ttk import Progressbar import sys import home import os root = Tk() # root.resizable(0, 0) image = PhotoImage( file = 'images\\loading.png' ) height = 653 width = 736 x = (root.winfo_screenwidth() / / 2 ) - (width / / 2 ) y = (root.winfo_screenheight() / / 2 ) - (height / / 2 ) root.geometry( '{}x{}+{}+{}' . format (width, height, x, y)) root.overrideredirect( 1 ) root.wm_attributes( '-topmost' , True ) root.lift() root.wm_attributes( "-topmost" , True ) root.wm_attributes( "-disabled" , True ) root.wm_attributes( "-transparentcolor" , "white" ) bg_label = Label(root, image = image, bg = 'white' ) bg_label.place(x = 0 , y = 0 ) progress_label = Label(root, text = "Please Wait..." , font = ( 'Comic Sans MS' , 13 , 'bold' ), fg = '#14183e' , bg = '#71b3ef' ) progress_label.place(x = 190 , y = 430 ) progress = Progressbar(root, orient = HORIZONTAL, length = 360 , mode = 'determinate' ) progress.place(x = 190 , y = 480 ) def top(): root.withdraw() os.system( "python home.py" ) root.destroy() i = 0 def load(): global i if i < = 10 : txt = 'Please Wait... ' + ( str ( 10 * i) + '%' ) progress_label.config(text = txt) progress_label.after( 1000 , load) progress[ 'value' ] = 10 * i i + = 1 else : top() load() root.mainloop() |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | #loadingscreen/home.py from tkinter import * from PIL import ImageTk, Image, ImageDraw import sqlite3 class HomePage: def __init__( self , System_window): self .System_window = System_window # Window Size and Placement System_window.rowconfigure( 0 , weight = 1 ) System_window.columnconfigure( 0 , weight = 1 ) height = 650 width = 700 x = (System_window.winfo_screenwidth() / / 2 ) - (width / / 2 ) y = (System_window.winfo_screenheight() / / 4 ) - (height / / 4 ) System_window.geometry( '{}x{}+{}+{}' . format (width, height, x, y)) System_window.resizable( 0 , 0 ) # window Icon icon = PhotoImage( file = 'images\\logo.png' ) System_window.iconphoto( True , icon) System_window.title( 'Inventory System' ) Label(System_window, text = "Username" ).place(x = 40 ,y = 60 ) Label(System_window, text = "Password" ).place(x = 40 , y = 100 ) Button(System_window, text = "Submit" ).place(x = 40 , y = 130 ) Entry(System_window, width = 30 ).place(x = 110 , y = 60 ) Entry(System_window, width = 30 ).place(x = 110 , y = 100 ) def page(): window = Tk() HomePage(window) window.mainloop() if __name__ = = '__main__' : page() |
Run PS C:\python_dev\tkinter\loadingscreen> python loading.py