Python wx.ToolBar() Examples

The following are 30 code examples of wx.ToolBar(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module wx , or try the search function .
Example #1
Source File: backend_wx.py    From Computable with MIT License 6 votes vote down vote up
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() 
Example #2
Source File: backend_wx.py    From matplotlib-4-abaqus with MIT License 6 votes vote down vote up
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() 
Example #3
Source File: toolbar.py    From wxGlade with MIT License 6 votes vote down vote up
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 
Example #4
Source File: bug188_included_toolbar.py    From wxGlade with MIT License 6 votes vote down vote up
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 
Example #5
Source File: bug188_included_toolbar_Phoenix.py    From wxGlade with MIT License 6 votes vote down vote up
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 
Example #6
Source File: BasesEtc_Phoenix.py    From wxGlade with MIT License 5 votes vote down vote up
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 
Example #7
Source File: backend_wx.py    From twitter-stock-recommendation with MIT License 5 votes vote down vote up
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 
Example #8
Source File: BasesEtc_Classic.py    From wxGlade with MIT License 5 votes vote down vote up
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 
Example #9
Source File: BasesEtc.py    From wxGlade with MIT License 5 votes vote down vote up
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 
Example #10
Source File: bug188_standalone_toolbar_Phoenix.py    From wxGlade with MIT License 5 votes vote down vote up
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 
Example #11
Source File: bars_wo_parent.py    From wxGlade with MIT License 5 votes vote down vote up
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 
Example #12
Source File: BasesEtc_w_sizers_Phoenix.py    From wxGlade with MIT License 5 votes vote down vote up
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 
Example #13
Source File: Tool_Menu_EventBinding_Phoenix.py    From wxGlade with MIT License 5 votes vote down vote up
def __init__(self, *args, **kwds):
        # begin wxGlade: MyFrame.__init__
        kwds["style"] = kwds.get("style", 0) | wx.DEFAULT_FRAME_STYLE
        wx.Frame.__init__(self, *args, **kwds)
        self.SetSize((400, 300))
        self.SetTitle("frame")

        # Menu Bar
        self.frame_menubar = wx.MenuBar()
        wxglade_tmp_menu = wx.Menu()
        self.frame_menubar.item1 = wxglade_tmp_menu.Append(wx.ID_ANY, "My Menu Item 1", "")
        self.Bind(wx.EVT_MENU, self.on_menu_item1, id=self.frame_menubar.item1.GetId())
        item = wxglade_tmp_menu.Append(wx.ID_ANY, "My Menu Item 1", "without attribute name")
        self.Bind(wx.EVT_MENU, self.on_menu_item2, id=item.GetId())
        self.frame_menubar.Append(wxglade_tmp_menu, "Menu 1")
        self.SetMenuBar(self.frame_menubar)
        # Menu Bar end

        # Tool Bar
        self.frame_toolbar = wx.ToolBar(self, -1)
        tool = self.frame_toolbar.AddTool(wx.ID_ANY, "My Tool", wx.Bitmap("..\\..\\icons\\button.xpm", wx.BITMAP_TYPE_ANY), wx.NullBitmap, wx.ITEM_NORMAL, "", "")
        self.Bind(wx.EVT_TOOL, self.on_my_tool, id=tool.GetId())
        self.SetToolBar(self.frame_toolbar)
        self.frame_toolbar.Realize()
        # Tool Bar end

        sizer_1 = wx.BoxSizer(wx.VERTICAL)

        sizer_1.Add((0, 0), 0, 0, 0)

        self.SetSizer(sizer_1)

        self.Layout()

        # end wxGlade 
Example #14
Source File: BasesEtc_w_sizers_Classic.py    From wxGlade with MIT License 5 votes vote down vote up
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

        sizer_1 = wx.BoxSizer(wx.HORIZONTAL)

        self.panel_1 = TestPanelWithBasesInFrame(self, wx.ID_ANY)
        sizer_1.Add(self.panel_1, 1, wx.EXPAND, 0)

        self.SetSizer(sizer_1)

        self.Layout()
        # end wxGlade

# end of class MyFrameWithBases 
Example #15
Source File: BasesEtc_w_sizers_Classic.py    From wxGlade with MIT License 5 votes vote down vote up
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 
Example #16
Source File: toplevel_extracode.py    From wxGlade with MIT License 5 votes vote down vote up
def __init__(self, *args, **kwds):
        # begin wxGlade: wxToolBar.__init__
        # toolbar extracode before
        kwds["style"] = kwds.get("style", 0)
        wx.ToolBar.__init__(self, *args, **kwds)
        self.Realize()
        # toolbar extracode after
        # end wxGlade

# end of class wxToolBar 
Example #17
Source File: backend_wx.py    From coffeegrindsize with MIT License 5 votes vote down vote up
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 
Example #18
Source File: backend_wx.py    From coffeegrindsize with MIT License 5 votes vote down vote up
def __init__(self, toolmanager, parent, style=wx.TB_HORIZONTAL):
        ToolContainerBase.__init__(self, toolmanager)
        wx.ToolBar.__init__(self, parent, -1, style=style)
        self._toolitems = {}
        self._groups = {}
        self._last = None 
Example #19
Source File: backend_wx.py    From CogAlg with MIT License 5 votes vote down vote up
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 
Example #20
Source File: backend_wx.py    From CogAlg with MIT License 5 votes vote down vote up
def __init__(self, toolmanager, parent, style=wx.TB_HORIZONTAL):
        ToolContainerBase.__init__(self, toolmanager)
        wx.ToolBar.__init__(self, parent, -1, style=style)
        self._toolitems = {}
        self._groups = {} 
Example #21
Source File: backend_wx.py    From Computable with MIT License 5 votes vote down vote up
def __init__(self, canvas):
        wx.ToolBar.__init__(self, canvas.GetParent(), -1)
        NavigationToolbar2.__init__(self, canvas)
        self.canvas = canvas
        self._idle = True
        self.statbar = None 
Example #22
Source File: backend_wx.py    From ImageFusion with MIT License 5 votes vote down vote up
def __init__(self, canvas):
        wx.ToolBar.__init__(self, canvas.GetParent(), -1)
        NavigationToolbar2.__init__(self, canvas)
        self.canvas = canvas
        self._idle = True
        self.statbar = None 
Example #23
Source File: backend_wx.py    From Mastering-Elasticsearch-7.0 with MIT License 5 votes vote down vote up
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 
Example #24
Source File: backend_wx.py    From Mastering-Elasticsearch-7.0 with MIT License 5 votes vote down vote up
def __init__(self, toolmanager, parent, style=wx.TB_HORIZONTAL):
        ToolContainerBase.__init__(self, toolmanager)
        wx.ToolBar.__init__(self, parent, -1, style=style)
        self._toolitems = {}
        self._groups = {} 
Example #25
Source File: backend_wx.py    From matplotlib-4-abaqus with MIT License 5 votes vote down vote up
def __init__(self, canvas):
        wx.ToolBar.__init__(self, canvas.GetParent(), -1)
        NavigationToolbar2.__init__(self, canvas)
        self.canvas = canvas
        self._idle = True
        self.statbar = None 
Example #26
Source File: ReaderToolbar.py    From pyscard with GNU Lesser General Public License v2.1 5 votes vote down vote up
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() 
Example #27
Source File: backend_wx.py    From neural-network-animation with MIT License 5 votes vote down vote up
def __init__(self, canvas):
        wx.ToolBar.__init__(self, canvas.GetParent(), -1)
        NavigationToolbar2.__init__(self, canvas)
        self.canvas = canvas
        self._idle = True
        self.statbar = None 
Example #28
Source File: backend_wx.py    From GraphicDesignPatternByPython with MIT License 5 votes vote down vote up
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 
Example #29
Source File: backend_wx.py    From GraphicDesignPatternByPython with MIT License 5 votes vote down vote up
def __init__(self, toolmanager, parent, style=wx.TB_HORIZONTAL):
        ToolContainerBase.__init__(self, toolmanager)
        wx.ToolBar.__init__(self, parent, -1, style=style)
        self._toolitems = {}
        self._groups = {}
        self._last = None 
Example #30
Source File: backend_wx.py    From python3_ios with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
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