|
| 1 | +import os |
| 2 | +import sys |
| 3 | +from tkinter import * |
| 4 | +from tkinter.ttk import * |
| 5 | +import tkinter.messagebox |
| 6 | +from ctypes import windll |
| 7 | +import aboutPEStart as PE |
| 8 | +import infoPEStart as PE2 |
| 9 | + |
| 10 | +# Begin PE Start Menu for start |
| 11 | +smWindow = Tk() |
| 12 | +smWindow.iconbitmap(sys.executable) |
| 13 | +smWindow.title("PE Start Menu") |
| 14 | +smWindow_w, smWindow_h = 400, 300 |
| 15 | +smWindow_wscr, smWindow_hscr = smWindow.winfo_screenwidth(), smWindow.winfo_screenheight() |
| 16 | +x_smW = (smWindow_wscr/2) - (smWindow_w/2) |
| 17 | +y_smW = (smWindow_hscr/2) - (smWindow_h/2) |
| 18 | +smWindow.geometry( |
| 19 | +"%dx%d+%d+%d" %(smWindow_w, smWindow_h, x_smW, y_smW) |
| 20 | +) |
| 21 | +smWindow.maxsize(400, 300) |
| 22 | +smWindow.resizable(False, False) |
| 23 | + |
| 24 | +# Power function |
| 25 | +def wpeutilPower(chosePower): |
| 26 | + os.system(f"wpeutil {chosePower}") |
| 27 | +# Definitive function |
| 28 | +def executeStart(str_EXECMD): |
| 29 | + os.system(f"start {str_EXECMD}") |
| 30 | + |
| 31 | +# Button Image |
| 32 | +img_button1 = PhotoImage(file="icon\\exit_24.png") |
| 33 | +img_button2 = PhotoImage(file="icon\\shutdown_24.png") |
| 34 | +img_button3 = PhotoImage(file="icon\\archive_24.png") |
| 35 | +img_button4 = PhotoImage(file="icon\\conhost_24.png") |
| 36 | +img_button5 = PhotoImage(file="icon\\pwshell_24.png") |
| 37 | +img_button6 = PhotoImage(file="icon\\setup_24.png") |
| 38 | +img_button7 = PhotoImage(file="icon\\diskset_24.png") |
| 39 | +img_button10 = PhotoImage(file="icon\\info_24.png") |
| 40 | + |
| 41 | +# Button and label |
| 42 | +labelHead1 = Label(smWindow, anchor="w", width=400, justify=LEFT, text="Power") |
| 43 | +labelHead1.grid(column=0, row=0, padx=2, columnspan=400) |
| 44 | +button1 = Button( |
| 45 | + text="Exit & Restart", |
| 46 | + image=img_button1, |
| 47 | + compound=LEFT, |
| 48 | + command=smWindow.destroy) |
| 49 | +button1.grid(column=0, row=1, padx=2) |
| 50 | +button1 = Button( |
| 51 | + text="Shutdown", |
| 52 | + image=img_button2, |
| 53 | + compound=LEFT, |
| 54 | + command=lambda: wpeutilPower("shutdown")) |
| 55 | +button1.grid(column=1, row=1, padx=2) |
| 56 | + |
| 57 | +labelHead1 = Label(smWindow, anchor="w", width=400, justify=LEFT, text="Terminal") |
| 58 | +labelHead1.grid(column=0, row=2, padx=2, columnspan=400) |
| 59 | +button1 = Button( |
| 60 | + text="CMD", |
| 61 | + image=img_button4, |
| 62 | + compound=LEFT, |
| 63 | + command=lambda: executeStart("cmd.exe")) |
| 64 | +button1.grid(column=0, row=3, padx=2) |
| 65 | +button1 = Button( |
| 66 | + text="Powershell", |
| 67 | + image=img_button5, |
| 68 | + compound=LEFT, |
| 69 | + command=lambda: executeStart("powershell.exe")) |
| 70 | +button1.grid(column=1, row=3, padx=2) |
| 71 | + |
| 72 | +labelHead1 = Label(smWindow, anchor="w", width=400, justify=LEFT, text="Utilities") |
| 73 | +labelHead1.grid(column=0, row=4, padx=2, columnspan=400) |
| 74 | +button1 = Button( |
| 75 | + text="File Manager", |
| 76 | + image=img_button3, |
| 77 | + compound=LEFT, |
| 78 | + command=lambda: executeStart("%WINDIR%\\APP\\7-Zip\\7zFM.exe")) |
| 79 | +button1.grid(column=0, row=5, padx=2) |
| 80 | +button1 = Button( |
| 81 | + text="DISKPART", |
| 82 | + image=img_button7, |
| 83 | + compound=LEFT, |
| 84 | + command=lambda: executeStart("DISKPART.exe")) |
| 85 | +button1.grid(column=1, row=5, padx=2) |
| 86 | +button1 = Button( |
| 87 | + text="NTSetup", # WinNTSetup by JFX ~ ENDGAME |
| 88 | + image=img_button6, |
| 89 | + compound=LEFT, |
| 90 | + command=lambda: executeStart("%WINDIR%\\APP\\WinNTSetup\\WinNTSetup_x64.exe")) |
| 91 | +button1.grid(column=2, row=5, padx=2) |
| 92 | + |
| 93 | +labelHead1 = Label(smWindow, anchor="w", width=400, justify=LEFT, text="Other") |
| 94 | +labelHead1.grid(column=0, row=6, padx=2, columnspan=400) |
| 95 | +button1 = Button( |
| 96 | + text="What's PE?", |
| 97 | + image=img_button10, |
| 98 | + compound=LEFT, |
| 99 | + command=PE2.messageInfoBoxPE) |
| 100 | +button1.grid(column=0, row=7, padx=2) |
| 101 | +button1 = Button( |
| 102 | + text="About", |
| 103 | + image=img_button10, |
| 104 | + compound=LEFT, |
| 105 | + command=PE.aboutPEStart) |
| 106 | +button1.grid(column=1, row=7, padx=2) |
| 107 | + |
| 108 | +smWindow.mainloop() |
0 commit comments