Für die Zeile:Aufruf von Funktionen in tkinter
file_Menu.add_command(label = 'New', command = do_Nothing)
warum wird die Funktion command = do_Nothing
statt command = do_Nothing()
genannt?
Der gesamte Code ist unten:
# Tkinter GUI Menu
from tkinter import *
### Functions ###
# Do Nothing
def do_Nothing():
print('I just did... nothing')
### Create tkinter window ###
# Create Window
root = Tk()
#### Creating the Menu(s) ###
# Create the Menu Bar
menu_Bar = Menu(master = root)
# Create File Menu
file_Menu = Menu(master = menu_Bar)
### Displaying the Menu(s) ###
# Display Menu Bar
root.config(menu = menu_Bar)
# Display File Menu
menu_Bar.add_cascade(label = 'File', menu = file_Menu)
### File Menu Properties ####
# New
file_Menu.add_command(label = 'New', command = do_Nothing)
# Open
file_Menu.add_command(label = 'Open', command = do_Nothing)
# Exit
file_Menu.add_command(label = 'Exit', command = root.quit)
### Display tkinter window ###
root.mainloop()