def create_toolbutton(entries, parent=None):
    """Create a toolbutton.

    Args:
        entries: List of (label, slot) tuples.

    Returns:
        `QtGui.QToolBar`.
    """
    btn = QtGui.QToolButton(parent)
    menu = QtGui.QMenu()
    actions = []

    for label, slot in entries:
        action = add_menu_action(menu, label, slot)
        actions.append(action)

    btn.setPopupMode(QtGui.QToolButton.MenuButtonPopup)
    btn.setDefaultAction(actions[0])
    btn.setMenu(menu)
    return btn, actions
def create_toolbutton ( entries , parent = None ) : btn = QtGui . QToolButton ( parent ) menu = QtGui . QMenu ( ) actions = [ ] for label , slot in entries : action = add_menu_action ( menu , label , slot ) actions . append ( action ) btn . setPopupMode ( QtGui . QToolButton . MenuButtonPopup ) btn . setDefaultAction ( actions [ 0 ] ) btn . setMenu ( menu ) return btn , actions
Create a toolbutton.

    Args:
        entries: List of (label, slot) tuples.

    Returns:
        `QtGui.QToolBar`.