当前位置: 首页>>代码示例>>Python>>正文


Python wx.ToolBar方法代码示例

本文整理汇总了Python中wx.ToolBar方法的典型用法代码示例。如果您正苦于以下问题:Python wx.ToolBar方法的具体用法?Python wx.ToolBar怎么用?Python wx.ToolBar使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在wx的用法示例。


在下文中一共展示了wx.ToolBar方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: import wx [as 别名]
# 或者: from wx import ToolBar [as 别名]
def __init__(self, canvas, can_kill=False):
        wx.ToolBar.__init__(self, canvas.GetParent(), -1)
        DEBUG_MSG("__init__()", 1, self)
        self.canvas = canvas
        self._lastControl = None
        self._mouseOnButton = None

        self._parent = canvas.GetParent()
        self._NTB_BUTTON_HANDLER = {
            _NTB_X_PAN_LEFT  : self.panx,
            _NTB_X_PAN_RIGHT : self.panx,
            _NTB_X_ZOOMIN    : self.zoomx,
            _NTB_X_ZOOMOUT   : self.zoomy,
            _NTB_Y_PAN_UP    : self.pany,
            _NTB_Y_PAN_DOWN  : self.pany,
            _NTB_Y_ZOOMIN    : self.zoomy,
            _NTB_Y_ZOOMOUT   : self.zoomy }


        self._create_menu()
        self._create_controls(can_kill)
        self.Realize() 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:24,代码来源:backend_wx.py

示例2: _create_popup_menu

# 需要导入模块: import wx [as 别名]
# 或者: from wx import ToolBar [as 别名]
def _create_popup_menu(self, widget):
        menu = misc.wxGladePopupMenu(self.name)

        if self.widget and self.is_visible():
            item = misc.append_menu_item(menu, -1, _('Hide'))
            misc.bind_menu_item_after(widget, item, self.hide_widget)
        else:
            i = misc.append_menu_item(menu, -1, _('Show'))
            misc.bind_menu_item_after(widget, i, common.app_tree.show_toplevel, None, self)
        menu.AppendSeparator()

        i = misc.append_menu_item(menu, -1, _('Remove ToolBar\tDel'), wx.ART_DELETE)
        misc.bind_menu_item_after(widget, i, self.remove)

        item = misc.append_menu_item(menu, -1, _('Edit tools ...'))
        misc.bind_menu_item_after(widget, item, self.properties["tools"].edit_tools)

        item = misc.append_menu_item(menu, -1, _('Hide'))
        misc.bind_menu_item_after(widget, item, self.hide_widget)

        return menu 
开发者ID:wxGlade,项目名称:wxGlade,代码行数:23,代码来源:toolbar.py

示例3: __init__

# 需要导入模块: import wx [as 别名]
# 或者: from wx import ToolBar [as 别名]
def __init__(self, *args, **kwds):
        # begin wxGlade: MyFrame.__init__
        kwds["style"] = kwds.get("style", 0)
        wx.Frame.__init__(self, *args, **kwds)
        self.SetSize((200, 200))
        self.SetTitle("frame_1")

        # Tool Bar
        self.frame_1_toolbar = wx.ToolBar(self, -1)
        self.frame_1_toolbar.AddLabelTool(wx.ID_UP, "UpDown", wx.ArtProvider.GetBitmap(wx.ART_GO_UP, wx.ART_OTHER, (32, 32)), wx.ArtProvider.GetBitmap(wx.ART_GO_DOWN, wx.ART_OTHER, (32, 32)), wx.ITEM_CHECK, "Up or Down", "Up or Down")
        self.SetToolBar(self.frame_1_toolbar)
        self.frame_1_toolbar.Realize()
        # Tool Bar end

        sizer_1 = wx.BoxSizer(wx.VERTICAL)

        self.label_1 = wx.StaticText(self, wx.ID_ANY, "placeholder - every design\nneeds a toplevel window", style=wx.ALIGN_CENTER)
        sizer_1.Add(self.label_1, 1, wx.ALL | wx.EXPAND, 0)

        self.SetSizer(sizer_1)

        self.Layout()
        # end wxGlade

# end of class MyFrame 
开发者ID:wxGlade,项目名称:wxGlade,代码行数:27,代码来源:bug188_included_toolbar.py

示例4: __init__

# 需要导入模块: import wx [as 别名]
# 或者: from wx import ToolBar [as 别名]
def __init__(self, *args, **kwds):
        # begin wxGlade: MyFrame.__init__
        kwds["style"] = kwds.get("style", 0)
        wx.Frame.__init__(self, *args, **kwds)
        self.SetSize((200, 200))
        self.SetTitle("frame_1")

        # Tool Bar
        self.frame_1_toolbar = wx.ToolBar(self, -1)
        self.frame_1_toolbar.AddTool(wx.ID_UP, "UpDown", wx.ArtProvider.GetBitmap(wx.ART_GO_UP, wx.ART_OTHER, (32, 32)), wx.ArtProvider.GetBitmap(wx.ART_GO_DOWN, wx.ART_OTHER, (32, 32)), wx.ITEM_CHECK, "Up or Down", "Up or Down")
        self.SetToolBar(self.frame_1_toolbar)
        self.frame_1_toolbar.Realize()
        # Tool Bar end

        sizer_1 = wx.BoxSizer(wx.VERTICAL)

        self.label_1 = wx.StaticText(self, wx.ID_ANY, "placeholder - every design\nneeds a toplevel window", style=wx.ALIGN_CENTER)
        sizer_1.Add(self.label_1, 1, wx.ALL | wx.EXPAND, 0)

        self.SetSizer(sizer_1)

        self.Layout()
        # end wxGlade

# end of class MyFrame 
开发者ID:wxGlade,项目名称:wxGlade,代码行数:27,代码来源:bug188_included_toolbar_Phoenix.py

示例5: __init__

# 需要导入模块: import wx [as 别名]
# 或者: from wx import ToolBar [as 别名]
def __init__(self, canvas):
        wx.ToolBar.__init__(self, canvas.GetParent(), -1)
        NavigationToolbar2.__init__(self, canvas)
        self.canvas = canvas
        self._idle = True
        self.statbar = None 
开发者ID:miloharper,项目名称:neural-network-animation,代码行数:8,代码来源:backend_wx.py

示例6: __init__

# 需要导入模块: import wx [as 别名]
# 或者: from wx import ToolBar [as 别名]
def __init__(self, canvas):
        wx.ToolBar.__init__(self, canvas.GetParent(), -1)
        NavigationToolbar2.__init__(self, canvas)
        self.canvas = canvas
        self._idle = True
        self.statbar = None
        self.prevZoomRect = None
        # for now, use alternate zoom-rectangle drawing on all
        # Macs. N.B. In future versions of wx it may be possible to
        # detect Retina displays with window.GetContentScaleFactor()
        # and/or dc.GetContentScaleFactor()
        self.retinaFix = 'wxMac' in wx.PlatformInfo 
开发者ID:PacktPublishing,项目名称:Mastering-Elasticsearch-7.0,代码行数:14,代码来源:backend_wx.py

示例7: __init__

# 需要导入模块: import wx [as 别名]
# 或者: from wx import ToolBar [as 别名]
def __init__(self, parent):
        """Constructor, creating the reader toolbar."""
        wx.ToolBar.__init__(
           self,
           parent,
           pos=wx.DefaultPosition,
           size=wx.DefaultSize,
           style=wx.SIMPLE_BORDER | wx.TB_HORIZONTAL | wx.TB_FLAT | wx.TB_TEXT,
           name='Reader Toolbar')

        # create bitmaps for toolbar
        tsize = (16, 16)
        if None != ICO_READER:
            bmpReader = wx.Bitmap(ICO_READER, wx.BITMAP_TYPE_ICO)
        else:
            bmpReader = wx.ArtProvider_GetBitmap(
                wx.ART_HELP_BOOK, wx.ART_OTHER, tsize)
        if None != ICO_SMARTCARD:
            bmpCard = wx.Bitmap(ICO_SMARTCARD, wx.BITMAP_TYPE_ICO)
        else:
            bmpCard = wx.ArtProvider_GetBitmap(
                wx.ART_HELP_BOOK, wx.ART_OTHER, tsize)
        self.readercombobox = ReaderComboBox(self)

        # create and add controls
        self.AddSimpleTool(
            10,
            bmpReader,
            "Select smart card reader",
            "Select smart card reader")
        self.AddControl(self.readercombobox)
        self.AddSeparator()
        self.AddSimpleTool(
            20,
            bmpCard, "Connect to smartcard",
            "Connect to smart card")
        self.AddSeparator()

        self.Realize() 
开发者ID:LudovicRousseau,项目名称:pyscard,代码行数:41,代码来源:ReaderToolbar.py

示例8: __init__

# 需要导入模块: import wx [as 别名]
# 或者: from wx import ToolBar [as 别名]
def __init__(self, parent, ops=[], *a, **k):
        size = wx.the_app.config['toolbar_size']
        self.size = size

        style = self.default_style
        config = wx.the_app.config
        if config['toolbar_text']:
            style |= wx.TB_TEXT

        wx.ToolBar.__init__(self, parent, style=style, **k)

        self.SetToolBitmapSize((size,size))

        while ops:
            opset = ops.pop(0)
            for e in opset:
                if issubclass(type(e.image), (str,unicode)):
                    bmp = wx.ArtProvider.GetBitmap(e.image, wx.ART_TOOLBAR, (size,size))
                elif type(e.image) is tuple:
                    i = wx.the_app.theme_library.get(e.image, self.size)
                    bmp = wx.BitmapFromImage(i)
                    assert bmp.Ok(), "The image (%s) is not valid." % i
                self.AddLabelTool(e.id, e.label, bmp, shortHelp=e.shorthelp)

            if len(ops):
                self.AddSeparator()

        self.Realize() 
开发者ID:kenorb-contrib,项目名称:BitTorrent,代码行数:30,代码来源:DownloadManager.py

示例9: get_items

# 需要导入模块: import wx [as 别名]
# 或者: from wx import ToolBar [as 别名]
def get_items(self):
        "returns the contents of self.tool_items as a list of tools that describes the contents of the ToolBar"
        tools = []
        for i in range(self.items.GetItemCount()):
            item = self._get_item(i)
            kwargs = dict( key_value for key_value in zip(self.columns,item))
            tools.append( Tool( **kwargs ) )
        return tools 
开发者ID:wxGlade,项目名称:wxGlade,代码行数:10,代码来源:toolbar.py

示例10: create_widget

# 需要导入模块: import wx [as 别名]
# 或者: from wx import ToolBar [as 别名]
def create_widget(self):
        tb_style = wx.TB_HORIZONTAL | self.style
        if wx.Platform == '__WXGTK__':
            tb_style |= wx.TB_DOCKABLE | wx.TB_FLAT
        if self.IS_TOPLEVEL:
            # "top-level" toolbar
            self.widget = wx.Frame(None, -1, misc.design_title(self.name))
            self.widget.SetClientSize((400, 30))
            self._tb = wx.ToolBar(self.widget, -1, style=tb_style)
            self.widget.SetToolBar(self._tb)
            self.widget.SetBackgroundColour(self.widget.GetBackgroundColour())
            icon = compat.wx_EmptyIcon()
            xpm = os.path.join(config.icons_path, 'toolbar.xpm')
            icon.CopyFromBitmap(misc.get_xpm_bitmap(xpm))
            self.widget.SetIcon(icon)
            self.widget.Bind(wx.EVT_CLOSE, lambda e: self.hide_widget())
            self.widget.Bind(wx.EVT_LEFT_DOWN, self.on_set_focus)
            if wx.Platform == '__WXMSW__':
                # MSW isn't smart enough to avoid overlapping windows, so
                # at least move it away from the 3 wxGlade frames
                self.widget.CenterOnScreen()
        else:
            # toolbar for a Frame
            self.widget = self._tb = wx.ToolBar(self.parent.widget, -1, style=tb_style)
            self.parent.widget.SetToolBar(self.widget)

        self.widget.Bind(wx.EVT_LEFT_DOWN, self.on_set_focus)

        # set the various property values
        self._set_bitmapsize()
        self._set_margins()
        self._set_packing()
        self._set_separation()

        self._set_tools()  # show the menus 
开发者ID:wxGlade,项目名称:wxGlade,代码行数:37,代码来源:toolbar.py

示例11: xml_builder

# 需要导入模块: import wx [as 别名]
# 或者: from wx import ToolBar [as 别名]
def xml_builder(parser, base, name, parent, index):
    "factory to build EditToolBar objects from a XML file"
    if parent.IS_ROOT:
        return EditTopLevelToolBar(name, parent, "ToolBar")

    parent.properties["toolbar"].set(True)
    return EditToolBar(name, parent) 
开发者ID:wxGlade,项目名称:wxGlade,代码行数:9,代码来源:toolbar.py

示例12: __init__

# 需要导入模块: import wx [as 别名]
# 或者: from wx import ToolBar [as 别名]
def __init__(self, *args, **kwds):
        # begin wxGlade: MyFrameWithBases.__init__
        kwds["style"] = kwds.get("style", 0) | wx.DEFAULT_FRAME_STYLE
        TestFrame.__init__(self, *args, **kwds)
        testframe.TestFrame.__init__(self)
        self.SetSize((400, 300))
        self.SetTitle("frame")

        # Menu Bar
        self.frame_copy_menubar = wx.MenuBar()
        self.SetMenuBar(self.frame_copy_menubar)
        # Menu Bar end

        self.frame_copy_statusbar = self.CreateStatusBar(1)
        self.frame_copy_statusbar.SetStatusWidths([-1])
        # statusbar fields
        frame_copy_statusbar_fields = ["frame_copy_statusbar"]
        for i in range(len(frame_copy_statusbar_fields)):
            self.frame_copy_statusbar.SetStatusText(frame_copy_statusbar_fields[i], i)

        # Tool Bar
        self.frame_copy_toolbar = wx.ToolBar(self, -1)
        self.SetToolBar(self.frame_copy_toolbar)
        self.frame_copy_toolbar.Realize()
        # Tool Bar end

        self.panel_1 = TestPanelWithBasesInFrame(self, wx.ID_ANY)
        self.Layout()
        # end wxGlade

# end of class MyFrameWithBases 
开发者ID:wxGlade,项目名称:wxGlade,代码行数:33,代码来源:BasesEtc_Phoenix.py

示例13: __init__

# 需要导入模块: import wx [as 别名]
# 或者: from wx import ToolBar [as 别名]
def __init__(self, *args, **kwds):
        # begin wxGlade: wxToolBar.__init__
        kwds["style"] = kwds.get("style", 0)
        wx.ToolBar.__init__(self, *args, **kwds)
        self.Realize()
        # end wxGlade

# end of class wxToolBar 
开发者ID:wxGlade,项目名称:wxGlade,代码行数:10,代码来源:BasesEtc.py

示例14: __init__

# 需要导入模块: import wx [as 别名]
# 或者: from wx import ToolBar [as 别名]
def __init__(self, *args, **kwds):
        # begin wxGlade: MyToolBar.__init__
        kwds["style"] = kwds.get("style", 0)
        wx.ToolBar.__init__(self, *args, **kwds)
        self.AddTool(wx.ID_UP, "UpDown", wx.ArtProvider.GetBitmap(wx.ART_GO_UP, wx.ART_OTHER, (32, 32)), wx.ArtProvider.GetBitmap(wx.ART_GO_DOWN, wx.ART_OTHER, (32, 32)), wx.ITEM_CHECK, "Up or Down", "Up or Down")
        self.Realize()
        # end wxGlade

# end of class MyToolBar 
开发者ID:wxGlade,项目名称:wxGlade,代码行数:11,代码来源:bug188_standalone_toolbar_Phoenix.py

示例15: __init__

# 需要导入模块: import wx [as 别名]
# 或者: from wx import ToolBar [as 别名]
def __init__(self, *args, **kwds):
        # begin wxGlade: MyToolBar.__init__
        kwds["style"] = kwds.get("style", 0)
        wx.ToolBar.__init__(self, *args, **kwds)
        self.Realize()
        # end wxGlade

# end of class MyToolBar 
开发者ID:wxGlade,项目名称:wxGlade,代码行数:10,代码来源:bars_wo_parent.py


注:本文中的wx.ToolBar方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。