from GUI import Window, Menu, Label, application

class MenuTestWindow(Window):

    is_hoopy = 1
    is_smeggy = 0

    def setup_menus(self, m):
        m.hoopy_cmd.enabled = 1
        m.smeggy_cmd.enabled = 1
        m.hoopy_cmd.checked = self.is_hoopy
        m.smeggy_cmd.checked = self.is_smeggy
        m.flavour_cmd.enabled = 1

    def hoopy_cmd(self):
        self.is_hoopy = 1
        self.is_smeggy = 0

    def smeggy_cmd(self):
        self.is_hoopy = 0
        self.is_smeggy = 1
    
    def flavour_cmd(self, i):
        if self.is_hoopy:
            hs = "Hoopy"
        else:
            hs = "Smeggy"
        lbl.text = "%s Flavour %s" % (hs, i)


menus = [
    Menu("Flavour",
        ("Hoopy", 'hoopy_cmd'),
        ("Smeggy", 'smeggy_cmd'),
        ("-"),
        (["Vanilla", "Strawberry", "Chocolate"], 'flavour_cmd'),
    )
]

win = MenuTestWindow(title = "Menus", size = (240, 60))
win.menus = menus
lbl = Label("Select a Flavour", position = (20, 20), size = (200, 20))
win.add(lbl)
win.show()

application().run()
