def __init__(self):
        self.Text = 'Simple Menu'
        self.Size = Size(380, 200)

        ms = MenuStrip()
        ms.Parent = self

        filem = ToolStripMenuItem("&File")
        exit = ToolStripMenuItem("&Exit", None,
            self.OnExit)

        importm = ToolStripMenuItem()
        importm.Text = "Import"

        filem.DropDownItems.Add(importm)

        temp = ToolStripMenuItem()
        temp.Text = "Import newsfeed list..."
        importm.DropDownItems.Add(temp)

        temp = ToolStripMenuItem()
        temp.Text = "Import bookmarks..."
        importm.DropDownItems.Add(temp)

        temp = ToolStripMenuItem()
        temp.Text = "Import mail..."
        importm.DropDownItems.Add(temp)

        filem.DropDownItems.Add(exit)

        ms.Items.Add(filem)
        self.MainMenuStrip = ms
        
        self.CenterToScreen()
Beispiel #2
0
    def createMenuItem(self, text, handler=None, keys=None):
        menuItem = ToolStripMenuItem()
        menuItem.Text = text

        if keys:
            menuItem.ShortcutKeys = keys
        if handler:
            menuItem.Click += handler
        return menuItem