The Popup is a Button subclass which represents Cocoa’s NSPopUpButton.
Parameters: |
|
---|
If the items argument is not None, the strings in that list will be added to the popup’s menu.
Menu. Although this is a View attribute (for context menus), it has a special role in the Popup because it’s the menu that pops up when you click on it. The difference with the View’s attribute is that you don’t have to create a Menu instance yourself, it’s already automatically created for you.
Boolean. Tells whether the poopup is of “Pull Down” style. Equivalent to [self pullsDown].
Cocoa constant. The arrow position (center, bottom or none) in the pop up. In Cocoa, it’s cell.arrowPosition. Use with NSPopUpArrowPosition constants.
Many apps have an “Action” menu, a pop up menu with the little “gears” icon that gives access to a menu with different actions to perform. There’s a couple of things to keep in mind when you construct these menus:
Anyway, here’s an example you can use:
actionPopup = Popup(window)
actionPopup.pullsdown = True
actionPopup.bezelStyle = const.NSTexturedRoundedBezelStyle
actionPopup.arrowPosition = const.NSPopUpArrowAtBottom
firstItem = actionPopup.menu.addItem("")
firstItem.hidden = True
firstItem.image = 'NSActionTemplate'
actionPopup.menu.addItem("Action 1")
actionPopup.menu.addItem("Action 2")
actionPopup.menu.addItem("Action 3")