70 lines
1.8 KiB
Python
70 lines
1.8 KiB
Python
#############################################################################################
|
|
##
|
|
## Python Karteikarten Quiz Script
|
|
##
|
|
## by H4nSolo (Christian Bergs)
|
|
##
|
|
## Version 1.0 Alpha
|
|
##
|
|
#############################################################################################
|
|
|
|
import tkinter as tk
|
|
from tkinter import Menu
|
|
from tkinter.filedialog import askopenfilename
|
|
|
|
def open_database():
|
|
# tk().withdraw()
|
|
filename = askopenfilename()
|
|
print(filename)
|
|
# print("Open Database selected")
|
|
|
|
def reload():
|
|
print("Reload selected")
|
|
|
|
def quit_app():
|
|
root.quit()
|
|
|
|
def start_questions():
|
|
print("Start selected")
|
|
|
|
def stop_questions():
|
|
print("Stop selected")
|
|
|
|
def new_questions():
|
|
print("New Questions selected")
|
|
|
|
def edit_questions():
|
|
print("Edit Questions selected")
|
|
|
|
def about():
|
|
print("About selected")
|
|
|
|
root = tk.Tk()
|
|
root.title("Dropdown Menüleiste Beispiel")
|
|
|
|
menubar = Menu(root)
|
|
|
|
# File menu
|
|
filemenu = Menu(menubar, tearoff=0)
|
|
filemenu.add_command(label="Open Database", command=open_database)
|
|
filemenu.add_command(label="Reload", command=reload)
|
|
filemenu.add_separator()
|
|
filemenu.add_command(label="Quit", command=quit_app)
|
|
menubar.add_cascade(label="File", menu=filemenu)
|
|
|
|
# Questions menu
|
|
questionsmenu = Menu(menubar, tearoff=0)
|
|
questionsmenu.add_command(label="Start", command=start_questions)
|
|
questionsmenu.add_command(label="Stop", command=stop_questions)
|
|
questionsmenu.add_separator()
|
|
questionsmenu.add_command(label="New Questions", command=new_questions)
|
|
questionsmenu.add_command(label="Edit Questions", command=edit_questions)
|
|
menubar.add_cascade(label="Questions", menu=questionsmenu)
|
|
|
|
# About menu
|
|
aboutmenu = Menu(menubar, tearoff=0)
|
|
aboutmenu.add_command(label="About", command=about)
|
|
menubar.add_cascade(label="About", menu=aboutmenu)
|
|
|
|
root.config(menu=menubar)
|
|
root.mainloop() |