Finish Project
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
import tkinter as tk
|
||||
import tkinter.messagebox as messagebox
|
||||
import os
|
||||
import sys
|
||||
|
||||
def on_closing():
|
||||
messagebox.showerror("Fehler", "Bitte verwenden Sie den Absenden-Button!")
|
||||
|
||||
def create_gui(result_container):
|
||||
def submit():
|
||||
kundenummer = entry.get()
|
||||
if not kundenummer.strip(): # Überprüfung, ob das Feld leer ist
|
||||
messagebox.showerror("Fehler", "Das Kundenummer-Feld darf nicht leer sein!")
|
||||
return
|
||||
result_container.append(kundenummer)
|
||||
root.destroy()
|
||||
|
||||
def get_path(filename):
|
||||
if hasattr(sys, "_MEIPASS"):
|
||||
return os.path.join(sys._MEIPASS, filename)
|
||||
else:
|
||||
return filename
|
||||
|
||||
|
||||
# Fenster erstellen
|
||||
root = tk.Tk()
|
||||
root.title("Rustdesk Installation")
|
||||
root.geometry("400x100")
|
||||
root.resizable(False, False)
|
||||
root.iconbitmap(get_path('rustdesk.ico'))
|
||||
|
||||
winWidth = 400
|
||||
winHeight = 100
|
||||
posRight = int(root.winfo_screenwidth() / 2 - winWidth / 2)
|
||||
posDown = int(root.winfo_screenheight() / 2 - winHeight / 2)
|
||||
root.geometry("+{}+{}".format(posRight, posDown))
|
||||
|
||||
text = tk.Label(root,
|
||||
text="Das ist die Installation von Rustdesk auf diesem PC. \nBitte geben sie Kundennummer ein die ihnen der Support mitgeteilt hat.",
|
||||
anchor='w', justify=tk.LEFT)
|
||||
text.grid(row=0, column=0, columnspan=3, padx=0, pady=5, sticky='w')
|
||||
|
||||
label = tk.Label(root, text="Kundenummer:", anchor='w')
|
||||
label.grid(row=1, column=0, padx=10, pady=5, sticky='w')
|
||||
|
||||
entry = tk.Entry(root)
|
||||
entry.focus_set()
|
||||
entry.grid(row=1, column=1, padx=10, pady=5, sticky='w')
|
||||
|
||||
entry.bind('<Return>', lambda event: submit())
|
||||
|
||||
button = tk.Button(root, text="Absenden", command=submit)
|
||||
button.grid(row=1, column=2, padx=20, pady=20)
|
||||
|
||||
root.protocol("WM_DELETE_WINDOW", on_closing)
|
||||
|
||||
root.mainloop()
|
||||
Reference in New Issue
Block a user