Menu Bar in Eto

eto
python

#1

Trying to create a dialog with a menu bar using Eto. I’m stuck with just the basic menu items at the top, cannot figure out how to get the drop down once they are clicked.

working code inside the dialog is something like:

mnuFile = forms.ButtonMenuItem(Text = “File”)
mnuEdit = forms.ButtonMenuItem(Text = “Edit”)

mnuBar = forms.MenuBar(mnuFile, mnuEdit)

self.Menu = mnuBar

Just trying to recreate the familiar menubar, such as:
File
->Save
->Quit

Thanks,
Tim


(Nathan 'jesterKing' Letwory) #2

You need to add menu items to the file and edit items.

See https://github.com/picoe/Eto/blob/develop/samples/Tutorials/CSharp/Tutorial2/Main.cs#L44 for some inspiration.


(Menno Deij - van Rijswijk) #3

The save and quit button menu items should be added to the mnuFile.Items collection, see https://github.com/picoe/Eto/wiki/Tutorial-2-Menus-and-Toolbars for more information.


#4

Thanks @nathanletwory and @menno! I thought I tried this before, but I guess not. Working now!

mnuSave = forms.ButtonMenuItem(Text = "Save")
mnuFile.Items.Add(mnuSave)