當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。