PopupMenu (hwx.gui)¶
A PopupMenu Widget.
The PopupMenu is a specialized control that has the abilty of being selected. You can add items and commands to the popup menu.
- Inherits:
Properties¶
Public Methods¶
addChildren (self, children)
clear (self)
destroy (self)
enableGlobalActions (self, enable)
getMousePosition (self)
getRelativeMousePosition (self)
hide (self)
insertItem (self, text, menu=None, icon=None, command=None, enabled=True, visible=True, accel=None, checked=None, advancedTooltip=None)
insertMenu (self, text)
insertSeparator (self)
insertWidget (self, widget)
popup (self, event=None)
saveAsPng (self, fname)
setF1HelpTopic (self, helptopic)
setItemEnabled (self, index, enabled=True)
setProperties (self, kwds)
show (self)
Property Details¶
- property numOfItems¶
Returns the number of items in the popup menu.
Method Details¶
- addChildren(self, children)¶
Add child widgets/layouts into this widget.
Widget children get layed out using a VBoxLayout.
Typically, you’ll pass the parent/children into the constructor instead of calling this function directly.
- param children
- type children
list[Widget] | Layout
- clear(self)¶
Remove all items.
- destroy(self)¶
Deletes this and all its children.
- enableGlobalActions(self, enable)¶
Sets the state of Global Actions.
Disable the global actions to get key events.
- param enable
Determines whether to enable or disable global actions.
- type enable
bool
- getMousePosition(self)¶
Returns the mouse position.
- getRelativeMousePosition(self)¶
Returns the mouse position relative to this widget.
- hide(self)¶
Hides the widget.
- insertItem(self, text, menu=None, icon=None, command=None, enabled=True, visible=True, accel=None, checked=None, advancedTooltip=None)¶
Inserts item and command into menu.
- param text
The item text to be displayed.
- type text
str
- param menu
The menu object to insert.
- type menu
PopupMenu
- param icon
The icon file to be inserted on the left side of text.
- type icon
str
- param command
The callback method to be executed when item is clicked.
- type command
callback
- param enabled
Determines whether to enable the inserted item.
- type enabled
bool
- param visible
Determines whether the inserted item is visible.
- type visible
bool
- param accel
Keyboard accelerator to execute the command (e.g. ‘Del’)
- type accel
str
- param checked
Determines if the item is checkable. True or False makes it checkable.
- type checked
bool
- param advancedTooltip
UUID to display advanced tooltips.
- type advancedTooltip
str
- returns
The index where the item has been inserted.
- rtype
int
- insertMenu(self, text)¶
Adds and returns a cascading menu.
- insertSeparator(self)¶
Inserts a separator in the Pop menu.
- insertWidget(self, widget)¶
Inserts a widget into the menu
- popup(self, event=None)¶
Shows the Popup menu.
- param event
The event to get the mouse position.
- type event
MouseEvent
- saveAsPng(self, fname)¶
Saves the widget as a .png file.
- param fname
The file name for the .png
- type fname
str
- returns
True if it was saved succesfully, False otherwise.
- rtype
bool
- setF1HelpTopic(self, helptopic)¶
Popup web-browser helps when the user hits F1 when over this.
- param helptopic
Topic name user needs help in.
- type helptopic
str
- setItemEnabled(self, index, enabled=True)¶
Enables or Disables the menu item at the specified index.
- setProperties(self, kwds)¶
Internal method called from constructors.
- show(self)¶
Shows the widget.