Python wx.Notebook() Examples

The following are 30 code examples of wx.Notebook(). 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: objdictedit.py    From CANFestivino with GNU Lesser General Public License v2.1 6 votes vote down vote up
def _init_ctrls(self, prnt):
        wx.Frame.__init__(self, id=ID_OBJDICTEDIT, name='objdictedit',
              parent=prnt, pos=wx.Point(149, 178), size=wx.Size(1000, 700),
              style=wx.DEFAULT_FRAME_STYLE, title=_('Objdictedit'))
        self._init_utils()
        self.SetClientSize(wx.Size(1000, 700))
        self.SetMenuBar(self.MenuBar)
        self.Bind(wx.EVT_CLOSE, self.OnCloseFrame)
        if not self.ModeSolo:
            self.Bind(wx.EVT_MENU, self.OnSaveMenu, id=wx.ID_SAVE)
            accel = wx.AcceleratorTable([wx.AcceleratorEntry(wx.ACCEL_CTRL, 83, wx.ID_SAVE)])
            self.SetAcceleratorTable(accel)

        self.FileOpened = wx.Notebook(id=ID_OBJDICTEDITFILEOPENED,
              name='FileOpened', parent=self, pos=wx.Point(0, 0),
              size=wx.Size(0, 0), style=0)
        self.FileOpened.Bind(wx.EVT_NOTEBOOK_PAGE_CHANGED,
              self.OnFileSelectedChanged, id=ID_OBJDICTEDITFILEOPENED)

        self.HelpBar = wx.StatusBar(id=ID_OBJDICTEDITHELPBAR, name='HelpBar',
              parent=self, style=wx.ST_SIZEGRIP)
        self._init_coll_HelpBar_Fields(self.HelpBar)
        self.SetStatusBar(self.HelpBar) 
Example #2
Source File: bugdialog_ui.py    From wxGlade with MIT License 6 votes vote down vote up
def __init__(self, *args, **kwds):
        # begin wxGlade: UIBugDialog.__init__
        kwds["style"] = kwds.get("style", 0) | wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER
        wx.Dialog.__init__(self, *args, **kwds)
        self.SetSize((600, 400))
        self.notebook_1 = wx.Notebook(self, wx.ID_ANY, style=wx.NB_BOTTOM)
        self.nb1_pane_summary = wx.Panel(self.notebook_1, wx.ID_ANY)
        self.st_header = wx.StaticText(self.nb1_pane_summary, wx.ID_ANY, _("An internal error occurred while %(action)s"))
        self.st_summary = wx.StaticText(self.nb1_pane_summary, wx.ID_ANY, _("Error type: %(exc_type)s\nError summary: %(exc_msg)s"))
        self.st_report = wx.StaticText(self.nb1_pane_summary, wx.ID_ANY, _("This is a bug - please report it."))
        self.nb1_pane_details = wx.Panel(self.notebook_1, wx.ID_ANY)
        self.st_details = wx.StaticText(self.nb1_pane_details, wx.ID_ANY, _("Error details:"))
        self.tc_details = wx.TextCtrl(self.nb1_pane_details, wx.ID_ANY, "", style=wx.TE_MULTILINE)
        self.notebook_1_pane_1 = wx.Panel(self.notebook_1, wx.ID_ANY)
        self.tc_howto_report = wx.TextCtrl(self.notebook_1_pane_1, wx.ID_ANY, _("Writing a helpful bug report is easy if you follow some hints. The items below should help you to integrate useful information. They are not an absolute rule - it's more like a guideline.\n\n- What did you do? Maybe you want to include a screenshot.\n- What did you want to happen?\n- What did actually happen?\n- Provide a short example to reproduce the issue.\n- Include the internal error log file %(log_file)s if required.\n\nPlease open a new bug in the wxGlade bug tracker https://github.com/wxGlade/wxGlade/issues/ .\nAlternatively you can send the bug report to the wxGlade mailing list wxglade-general@lists.sourceforge.net. Keep in mind that you need a subscription for sending emails to this mailing list.\nThe subscription page is at https://sourceforge.net/projects/wxglade/lists/wxglade-general ."), style=wx.TE_MULTILINE | wx.TE_READONLY)
        self.static_line_1 = wx.StaticLine(self, wx.ID_ANY)
        self.btn_copy = wx.Button(self, wx.ID_COPY, "")
        self.btn_ok = wx.Button(self, wx.ID_OK, "")

        self.__set_properties()
        self.__do_layout()

        self.Bind(wx.EVT_BUTTON, self.OnCopy, self.btn_copy)
        # end wxGlade 
Example #3
Source File: Bugs_2018-01-16_Classic.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.DEFAULT_FRAME_STYLE
        wx.Frame.__init__(self, *args, **kwds)
        self.SetSize((400, 300))
        self.SetTitle("frame")

        sizer_1 = wx.BoxSizer(wx.VERTICAL)

        self.notebook_1 = wx.Notebook(self, wx.ID_ANY)
        sizer_1.Add(self.notebook_1, 1, wx.EXPAND, 0)

        self.panel_1 = YPanel(self.notebook_1, wx.ID_ANY)
        self.notebook_1.AddPage(self.panel_1, "Panel 1")

        self.panel_2 = XPanel(self.notebook_1, wx.ID_ANY)
        self.notebook_1.AddPage(self.panel_2, "Panel 2")

        self.SetSizer(sizer_1)

        self.Layout()
        # end wxGlade

# end of class MyFrame 
Example #4
Source File: Simple_Notebook.py    From topoflow with MIT License 6 votes vote down vote up
def __init__(self):
        wx.Frame.__init__(self, None, title="Simple Notebook Example")

        # Here we create a panel and a notebook on the panel
        p = wx.Panel(self)
        nb = wx.Notebook(p)

        # create the page windows as children of the notebook
        page1 = PageOne(nb)
        page2 = PageTwo(nb)
        page3 = PageThree(nb)

        # add the pages to the notebook with the label to show on the tab
        nb.AddPage(page1, "Page 1")
        nb.AddPage(page2, "Page 2")
        nb.AddPage(page3, "Page 3")

        # finally, put the notebook in a sizer for the panel to manage
        # the layout
        sizer = wx.BoxSizer()
        sizer.Add(nb, 1, wx.EXPAND)
        p.SetSizer(sizer) 
Example #5
Source File: Bling.py    From BitTorrent with GNU General Public License v3.0 6 votes vote down vote up
def __init__(self, parent, history, *a, **k):
        BTPanel.__init__(self, parent, *a, **k)
        #self.SetMinSize((200, 200))

        self.notebook = wx.Notebook(self, style=wx.CLIP_CHILDREN)

        self.statistics = StatisticsPanel(self.notebook, style=wx.CLIP_CHILDREN)
        self.notebook.AddPage(self.statistics, _("Statistics"))

        self.bling = BandwidthGraphPanel(self.notebook, history)
        self.speed_tab_index = self.notebook.GetPageCount()
        self.notebook.AddPage(self.bling, _("Speed"))

        self.notebook.Bind(wx.EVT_NOTEBOOK_PAGE_CHANGED, self.OnPageChanged)

        self.sizer.Add(self.notebook, flag=wx.GROW, proportion=1)

        self.Hide()
        self.sizer.Layout() 
Example #6
Source File: Output_Dialog.py    From topoflow with MIT License 6 votes vote down vote up
def Out_Variable_Notebook(self):
        
        notebook = wx.Notebook(self.panel, style=wx.BK_TOP)

        k = 0
        n_boxes = self.out_info.n_boxes

        labels = ['Grids', 'Values at Pixels', 'Stacks', \
                  'Z-profiles at Pixels']
        for k in range(n_boxes):
            data  = self.out_info.boxes[k]
            page  = TF_Output_Var_Box(parent=notebook, \
                                      data=data)
            notebook.AddPage(page, labels[k])

        return notebook
    
    #   Out_Variable_Notebook()
    #---------------------------------------------------------------- 
Example #7
Source File: Input_Dialog.py    From topoflow with MIT License 6 votes vote down vote up
def In_Variable_Notebook(self):
        
        notebook = wx.Notebook(self.panel, style=wx.BK_TOP)

        k = 0
        n_layers = self.proc_info.n_layers

        for k in range(n_layers):
            data  = self.proc_info.layers[k]
            kstr  = str(k+1)
            label = "Layer " + kstr + " variables"
            page  = TF_Input_Var_Box(parent=notebook, \
                                     data=data, \
                                     box_label=label)
            notebook.AddPage(page, "Layer " + kstr)

        return notebook
    
    #   In_Variable_Notebook()
    #---------------------------------------------------------------- 
Example #8
Source File: EtherCATManagementEditor.py    From OpenPLC_Editor with GNU General Public License v3.0 6 votes vote down vote up
def StringTest(self, check_string):
        """
        Test value 'name' is alphanumeric
        @param check_string : input data for check
        @return result : output data after check
        """
        # string.printable is print this result
        # '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
        # !"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~ \t\n\r\x0b\x0c
        allow_range = string.printable
        result = check_string
        for i in range(0, len(check_string)):
            # string.isalnum() is check whether string is alphanumeric or not
            if check_string[len(check_string)-1-i:len(check_string)-i] in allow_range:
                result = check_string[:len(check_string) - i]
                break
        return result


# -------------------------------------------------------------------------------
#                    For SDO Notebook (divide category)
# ------------------------------------------------------------------------------- 
Example #9
Source File: main.py    From wxGlade with MIT License 6 votes vote down vote up
def __init__(self, parent):
        wx.Panel.__init__( self, parent, -1, name='PropertyPanel' )
        self.SetBackgroundColour( compat.wx_SystemSettings_GetColour(wx.SYS_COLOUR_BTNFACE) )

        self.current_widget = None        # instance currently being edited
        self.next_widget = None           # the next one, will only be edited after a small delay

        self.pagenames = None

        sizer = wx.BoxSizer(wx.VERTICAL)
        self.heading = wx.TextCtrl(self, style=wx.TE_READONLY)
        sizer.Add(self.heading, 0, wx.EXPAND, 0)
        self.notebook = wx.Notebook(self)
        self.notebook.Bind(wx.EVT_SIZE, self.on_notebook_size)

        sizer.Add(self.notebook, 1, wx.EXPAND, 0)

        # for GTK3: add a panel to determine page size
        p = wx.Panel(self.notebook)
        self.notebook.AddPage(p, "panel")
        self._notebook_decoration_size = None
        p.Bind(wx.EVT_SIZE, self.on_panel_size)

        self.SetSizer(sizer)
        self.Layout() 
Example #10
Source File: EtherCATManagementEditor.py    From OpenPLC_Editor with GNU General Public License v3.0 6 votes vote down vote up
def __init__(self, parent, controler):
        """
        Constructor
        @param parent: Reference to the parent PDOPanelClass class
        @param controler: _EthercatSlaveCTN class in EthercatSlave.py
        """
        wx.Choicebook.__init__(self, parent, id=-1, size=(500, 500), style=wx.CHB_DEFAULT)
        self.Controler = controler

        RxWin = PDONoteBook(self, controler=self.Controler, name="Rx")
        TxWin = PDONoteBook(self, controler=self.Controler, name="Tx")
        self.AddPage(RxWin, "RxPDO")
        self.AddPage(TxWin, "TxPDO")


# -------------------------------------------------------------------------------
#                    For PDO Notebook (divide PDO index)
# ------------------------------------------------------------------------------- 
Example #11
Source File: config.py    From Gooey with MIT License 6 votes vote down vote up
def layoutComponent(self):
        # self.rawWidgets['contents'] = self.rawWidgets['contents'][1:2]
        self.notebook = wx.Notebook(self, style=wx.BK_DEFAULT)

        panels = [wx.Panel(self.notebook) for _ in self.rawWidgets['contents']]
        sizers = [wx.BoxSizer(wx.VERTICAL) for _ in panels]

        for group, panel, sizer in zip(self.rawWidgets['contents'], panels, sizers):
            self.makeGroup(panel, sizer, group, 0, wx.EXPAND)
            panel.SetSizer(sizer)
            panel.Layout()
            self.notebook.AddPage(panel, group['name'])
            self.notebook.Layout()


        _sizer = wx.BoxSizer(wx.VERTICAL)
        _sizer.Add(self.notebook, 1, wx.EXPAND)
        self.SetSizer(_sizer)
        self.Layout() 
Example #12
Source File: EtherCATManagementEditor.py    From OpenPLC_Editor with GNU General Public License v3.0 6 votes vote down vote up
def UpdateSubTable(self, row, col, data):
        """
        Updates sub table.
        It's done by deleting the sub table and creating it again.
        @param row, col: size of the table
        @param data: data
        """
        self.SubTable.Destroy()
        self.SubTable = RegisterSubTable(self, row, col)
        self.Sizer.Detach(self.MainTable)
        self.Sizer.AddMany([self.MainTable, self.SubTable])
        self.Sizer.Layout()
        self.SetSizer(self.Sizer)
        self.SubTable.CreateGrid(row, col)
        self.SubTable.SetValue(self, data)
        self.SubTable.Update()


# -------------------------------------------------------------------------------
#                    For Register Access Notebook Panel (Main Table)
# ------------------------------------------------------------------------------- 
Example #13
Source File: notebook.py    From wxGlade with MIT License 6 votes vote down vote up
def insert_tab(self, index, label):
        # add tab/page; called from GUI
        self.properties["tabs"].insert( index, [label,] )

        # create panel and node, add to tree
        self.insert_item(None, index)  # placeholder
        editor = EditPanel( self.next_pane_name(), self, index )

        if self.widget:
            # add to widget
            editor.create()
            compat.SetToolTip(editor.widget, _("Notebook page pane:\nAdd a sizer here") )
            self.vs_insert_tab(index)

            try:
                wx.CallAfter(editor.sel_marker.update)
            except AttributeError:
                #self._logger.exception(_('Internal Error'))
                if config.debugging: raise

            self.widget.SetSelection(index)

        self.properties["tabs"].update_display()
        misc.rebuild_tree(self) 
Example #14
Source File: IDEFrame.py    From OpenPLC_Editor with GNU General Public License v3.0 6 votes vote down vote up
def EditProjectSettings(self):
        old_values = self.Controler.GetProjectProperties()
        dialog = ProjectDialog(self)
        dialog.SetValues(old_values)
        if dialog.ShowModal() == wx.ID_OK:
            new_values = dialog.GetValues()
            new_values["creationDateTime"] = old_values["creationDateTime"]
            if new_values != old_values:
                self.Controler.SetProjectProperties(None, new_values)
                self._Refresh(TITLE, EDITORTOOLBAR, FILEMENU, EDITMENU, DISPLAYMENU,
                              PROJECTTREE, POUINSTANCEVARIABLESPANEL, SCALING)
        dialog.Destroy()

    # -------------------------------------------------------------------------------
    #                            Notebook Unified Functions
    # ------------------------------------------------------------------------------- 
Example #15
Source File: Bugs_2018-01-16_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.DEFAULT_FRAME_STYLE
        wx.Frame.__init__(self, *args, **kwds)
        self.SetSize((400, 300))
        self.SetTitle("frame")

        sizer_1 = wx.BoxSizer(wx.VERTICAL)

        self.notebook_1 = wx.Notebook(self, wx.ID_ANY)
        sizer_1.Add(self.notebook_1, 1, wx.EXPAND, 0)

        self.panel_1 = YPanel(self.notebook_1, wx.ID_ANY)
        self.notebook_1.AddPage(self.panel_1, "Panel 1")

        self.panel_2 = XPanel(self.notebook_1, wx.ID_ANY)
        self.notebook_1.AddPage(self.panel_2, "Panel 2")

        self.SetSizer(sizer_1)

        self.Layout()
        # end wxGlade

# end of class MyFrame 
Example #16
Source File: statisticspage.py    From magpy with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def __init__(self, *args, **kwds):
        scrolled.ScrolledPanel.__init__(self, *args, **kwds)
        # Create pages on MenuPanel
        nb = wx.Notebook(self,-1)
        self.stats_page = StatisticsPage(nb)
        nb.AddPage(self.stats_page, "Continuous Statistics")
        sizer = wx.BoxSizer()
        sizer.Add(nb, 1, wx.EXPAND)
        self.SetSizer(sizer)
        self.SetupScrolling() 
Example #17
Source File: PyOgg3.py    From wxGlade with MIT License 5 votes vote down vote up
def __init__(self, *args, **kwds):
        # begin wxGlade: PyOgg3_MyDialog.__init__
        kwds["style"] = wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER
        wx.Dialog.__init__(self, *args, **kwds)
        self.notebook_1 = wx.Notebook(self, wx.ID_ANY)
        self.notebook_1_pane_1 = wx.Panel(self.notebook_1, wx.ID_ANY)
        self.text_ctrl_1 = wx.TextCtrl(self.notebook_1_pane_1, wx.ID_ANY, "")
        self.button_3 = wx.Button(self.notebook_1_pane_1, wx.ID_OPEN, "")
        self.notebook_1_pane_2 = wx.Panel(self.notebook_1, wx.ID_ANY)
        self.radio_box_1 = wx.RadioBox(self.notebook_1_pane_2, wx.ID_ANY, _("Sampling Rate"), choices=[_("44 kbit"), _("128 kbit")], majorDimension=0, style=wx.RA_SPECIFY_ROWS)
        self.notebook_1_pane_3 = wx.Panel(self.notebook_1, wx.ID_ANY)
        self.text_ctrl_2 = wx.TextCtrl(self.notebook_1_pane_3, wx.ID_ANY, "", style=wx.TE_MULTILINE)
        self.notebook_1_pane_4 = wx.Panel(self.notebook_1, wx.ID_ANY)
        self.label_2 = wx.StaticText(self.notebook_1_pane_4, wx.ID_ANY, _("File name:"))
        self.text_ctrl_3 = wx.TextCtrl(self.notebook_1_pane_4, wx.ID_ANY, "")
        self.button_4 = wx.Button(self.notebook_1_pane_4, wx.ID_OPEN, "")
        self.checkbox_1 = wx.CheckBox(self.notebook_1_pane_4, wx.ID_ANY, _("Overwrite existing file"))
        self.static_line_1 = wx.StaticLine(self, wx.ID_ANY)
        self.button_5 = wx.Button(self, wx.ID_CLOSE, "")
        self.button_2 = wx.Button(self, wx.ID_CANCEL, "", style=wx.BU_TOP)
        self.button_1 = wx.Button(self, wx.ID_OK, "", style=wx.BU_TOP)

        self.__set_properties()
        self.__do_layout()

        self.Bind(wx.EVT_BUTTON, self.startConverting, self.button_1)
        # end wxGlade

        # manually added code
        print( 'Dialog has been created at ', time.asctime() ) 
Example #18
Source File: notebook.py    From wxGlade with MIT License 5 votes vote down vote up
def _get_parent_tooltip(self, index):
        return "Notebook page %s:"%index 
Example #19
Source File: bug165.py    From wxGlade with MIT License 5 votes vote down vote up
def __init__(self, *args, **kwds):
        # begin wxGlade: awxNotebook.__init__
        kwds["style"] = kwds.get("style", 0)
        wx.Notebook.__init__(self, *args, **kwds)

        self.notebook_1_pane_1 = wx.Panel(self, wx.ID_ANY)
        self.AddPage(self.notebook_1_pane_1, _("tab1"))
        # end wxGlade

# end of class awxNotebook 
Example #20
Source File: Notebook2.py    From topoflow with MIT License 5 votes vote down vote up
def __init__(self, parent):
        title = "Resize the dialog and see how controls adapt!"
        wx.Dialog.__init__(self, parent, -1, title,
                           style=wx.DEFAULT_DIALOG_STYLE|wx.RESIZE_BORDER)

        notebook = wx.Notebook(self, -1, size=(450,300))
        panel1 = wx.Panel(notebook)
        panel2 = wx.Panel(notebook)
        notebook.AddPage(panel1, "Panel 1")
        notebook.AddPage(panel2, "Panel 2")

        dialog_sizer = wx.BoxSizer(wx.VERTICAL)
        dialog_sizer.Add(notebook, 1, wx.EXPAND|wx.ALL, 5)

        panel1_sizer = wx.BoxSizer(wx.VERTICAL)
        text = wx.TextCtrl(panel1, -1, "Hi!", size=(400,90), style=wx.TE_MULTILINE)
        button1 = wx.Button(panel1, -1, "I only resize horizontally...")
        panel1_sizer.Add(text, 1, wx.EXPAND|wx.ALL, 10)
        panel1_sizer.Add(button1, 0, wx.EXPAND|wx.ALL, 10)
        panel1.SetSizer(panel1_sizer)

        panel2_sizer = wx.BoxSizer(wx.HORIZONTAL)
        button2 = wx.Button(panel2, -1, "I resize vertically")
        button3 = wx.Button(panel2, -1, "I don't like resizing!")
        panel2_sizer.Add(button2, 0, wx.EXPAND|wx.ALL, 20)
        panel2_sizer.Add(button3, 0, wx.ALL, 100)
        panel2.SetSizer(panel2_sizer)

        if "__WXMAC__" in wx.PlatformInfo:
           self.SetSizer(dialog_sizer)
        else:
           self.SetSizerAndFit(dialog_sizer)
        self.Centre()

        self.Bind(wx.EVT_BUTTON, self.OnButton) 
Example #21
Source File: EtherCATManagementEditor.py    From OpenPLC_Editor with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, parent, controler):
        """
        Constructor
        @param parent: Reference to the parent SDOPanelClass class
        @param controler: _EthercatSlaveCTN class in EthercatSlave.py
        """
        wx.Notebook.__init__(self, parent, id=-1, size=(850, 500))
        self.Controler = controler
        self.parent = parent

        self.CreateNoteBook() 
Example #22
Source File: EtherCATManagementEditor.py    From OpenPLC_Editor with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, parent, name, controler):
        """
        Constructor
        @param parent: Reference to the parent PDOChoicebook class
        @param name: identifier whether RxPDO or TxPDO
        @param controler: _EthercatSlaveCTN class in EthercatSlave.py
        """
        wx.Notebook.__init__(self, parent, id=-1, size=(640, 400))
        self.Controler = controler

        count = 0
        page_texts = []

        self.Controler.CommonMethod.RequestPDOInfo()

        if name == "Tx":
            # obtain pdo_info and pdo_entry
            # pdo_info include (PDO index, name, number of entry)
            pdo_info = self.Controler.CommonMethod.GetTxPDOCategory()
            pdo_entry = self.Controler.CommonMethod.GetTxPDOInfo()
            for tmp in pdo_info:
                title = str(hex(tmp['pdo_index']))
                page_texts.append(title)
        # RX PDO case
        else:
            pdo_info = self.Controler.CommonMethod.GetRxPDOCategory()
            pdo_entry = self.Controler.CommonMethod.GetRxPDOInfo()
            for tmp in pdo_info:
                title = str(hex(tmp['pdo_index']))
                page_texts.append(title)

        # Add page depending on the number of pdo_info
        for txt in page_texts:
            win = PDOEntryTable(self, pdo_info, pdo_entry, count)
            self.AddPage(win, txt)
            count += 1


# -------------------------------------------------------------------------------
#                    For PDO Grid (fill entry index, subindex etc...)
# ------------------------------------------------------------------------------- 
Example #23
Source File: AboutDialog.py    From OpenPLC_Editor with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, parent, info):
        wx.Dialog.__init__(self, parent, title=_("Credits"), size=(475, 320),
                           style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER)

        if parent and parent.GetIcon():
            self.SetIcon(parent.GetIcon())

        self.SetMinSize((300, 200))
        notebook = wx.Notebook(self)
        close = wx.Button(self, id=wx.ID_CLOSE, label=_("&Close"))
        close.SetDefault()

        developer = wx.TextCtrl(notebook, style=wx.TE_READONLY | wx.TE_MULTILINE)
        translators = wx.TextCtrl(notebook, style=wx.TE_READONLY | wx.TE_MULTILINE)

        developer.SetValue(u'\n'.join(info.Developers))
        translators.SetValue(u'\n'.join(info.Translators))

        notebook.AddPage(developer, text=_("Written by"))
        notebook.AddPage(translators, text=_("Translated by"))

        btnSizer = wx.BoxSizer(wx.HORIZONTAL)
        btnSizer.Add(close)

        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(notebook, 1, wx.EXPAND | wx.ALL, 10)
        sizer.Add(btnSizer, flag=wx.ALIGN_RIGHT | wx.RIGHT | wx.BOTTOM, border=10)
        self.SetSizer(sizer)
        self.Layout()
        self.Show()
        self.SetEscapeId(close.GetId())

        close.Bind(wx.EVT_BUTTON, lambda evt: self.Destroy()) 
Example #24
Source File: IDEFrame.py    From OpenPLC_Editor with GNU General Public License v3.0 5 votes vote down vote up
def AddPage(self, window, text):
        """Function that add a tab in Notebook, calling refresh for tab DClick event
        for wx.aui.AUINotebook.

        :param window: Panel to display in tab.
        :param text: title for the tab ctrl.
        """
        self.TabsOpened.AddPage(window, text)
        self.RefreshTabCtrlEvent() 
Example #25
Source File: IDEFrame.py    From OpenPLC_Editor with GNU General Public License v3.0 5 votes vote down vote up
def SetPageBitmap(self, idx, bitmap):
        """Function that fix difference in setting picture on tab between
        wx.Notebook and wx.aui.AUINotebook.

        :param idx: Tab index.
        :param bitmap: wx.Bitmap to define on tab.
        :returns: True if operation succeeded
        """
        return self.TabsOpened.SetPageBitmap(idx, bitmap)

    # -------------------------------------------------------------------------------
    #                         Dialog Message Functions
    # ------------------------------------------------------------------------------- 
Example #26
Source File: main.py    From nuxhash with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, parent, *args, **kwargs):
        wx.Frame.__init__(self, parent, *args, **kwargs)
        self.SetIcon(wx.Icon(wx.IconLocation(str(ICON_PATH))))
        self.SetSizeHints(minW=500, minH=500)
        self._Devices = self._ProbeDevices()
        self.Bind(wx.EVT_CLOSE, self.OnClose)
        self.Bind(EVT_PUBSUB, self.OnPubSend)

        # Create notebook and its pages.
        notebook = wx.Notebook(self)
        notebook.AddPage(
                MiningScreen(notebook, devices=self._Devices),
                text='Mining')
        notebook.AddPage(
                BenchmarksScreen(notebook, devices=self._Devices),
                text='Benchmarks')
        notebook.AddPage(
                SettingsScreen(notebook),
                text='Settings')
        notebook.AddPage(
                AboutScreen(notebook),
                text='About')

        # Check miner downloads.
        pub.subscribe(self._OnDownloadProgress, 'download.progress')
        self._DlThread = self._DlProgress = None
        self._DownloadMiners()

        # Read user data.
        pub.subscribe(self._OnSettings, 'data.settings')
        pub.subscribe(self._OnBenchmarks, 'data.benchmarks')

        loaded_settings = nuxhash.settings.load_settings(CONFIG_DIR)
        if loaded_settings == nuxhash.settings.DEFAULT_SETTINGS:
            self._FirstRun()
        pub.sendMessage('data.settings', settings=loaded_settings)

        benchmarks = nuxhash.settings.load_benchmarks(CONFIG_DIR, self._Devices)
        pub.sendMessage('data.benchmarks', benchmarks=benchmarks) 
Example #27
Source File: GUI_wxPython.py    From Python-GUI-Programming-Cookbook-Second-Edition with MIT License 5 votes vote down vote up
def createNotebook(self):
        panel = wx.Panel(self)
        notebook = wx.Notebook(panel)
        widgets = Widgets(notebook)
        notebook.AddPage(widgets, "Widgets")
        notebook.SetBackgroundColour(BACKGROUNDCOLOR) 
        # layout
        boxSizer = wx.BoxSizer()
        boxSizer.Add(notebook, 1, wx.EXPAND)
        panel.SetSizerAndFit(boxSizer)  
               
#======================
# Start GUI
#====================== 
Example #28
Source File: GUI_wxPython.py    From Python-GUI-Programming-Cookbook-Third-Edition with MIT License 5 votes vote down vote up
def createNotebook(self):
        panel = wx.Panel(self)
        notebook = wx.Notebook(panel)
        widgets = Widgets(notebook)
        notebook.AddPage(widgets, "Widgets")
        notebook.SetBackgroundColour(BACKGROUNDCOLOR) 
        # layout
        boxSizer = wx.BoxSizer()
        boxSizer.Add(notebook, 1, wx.EXPAND)
        panel.SetSizerAndFit(boxSizer)  
               
#======================
# Start GUI
#====================== 
Example #29
Source File: dfgui.py    From PandasDataFrameGUI with MIT License 5 votes vote down vote up
def __init__(self, df):
        wx.Frame.__init__(self, None, -1, "Pandas DataFrame GUI")

        # Here we create a panel and a notebook on the panel
        p = wx.Panel(self)
        nb = wx.Notebook(p)
        self.nb = nb

        columns = df.columns[:]
        if isinstance(columns,(pd.RangeIndex,pd.Int64Index)):
            # RangeIndex is not supported
            columns = pd.Index([str(i) for i in columns])
        self.CreateStatusBar(2, style=0)
        self.SetStatusWidths([200, -1])

        # create the page windows as children of the notebook
        self.page1 = DataframePanel(nb, df, self.status_bar_callback)
        self.page2 = ColumnSelectionPanel(nb, columns, self.page1.df_list_ctrl)
        self.page3 = FilterPanel(nb, columns, self.page1.df_list_ctrl, self.selection_change_callback)
        self.page4 = HistogramPlot(nb, columns, self.page1.df_list_ctrl)
        self.page5 = ScatterPlot(nb, columns, self.page1.df_list_ctrl)

        # add the pages to the notebook with the label to show on the tab
        nb.AddPage(self.page1, "Data Frame")
        nb.AddPage(self.page2, "Columns")
        nb.AddPage(self.page3, "Filters")
        nb.AddPage(self.page4, "Histogram")
        nb.AddPage(self.page5, "Scatter Plot")

        nb.Bind(wx.EVT_NOTEBOOK_PAGE_CHANGED, self.on_tab_change)

        # finally, put the notebook in a sizer for the panel to manage
        # the layout
        sizer = wx.BoxSizer()
        sizer.Add(nb, 1, wx.EXPAND)
        p.SetSizer(sizer)

        self.SetSize((800, 600))
        self.Center() 
Example #30
Source File: tabbar.py    From Gooey with MIT License 5 votes vote down vote up
def __init__(self, parent, buildSpec, configPanels, *args, **kwargs):
        super(Tabbar, self).__init__(parent, *args, **kwargs)
        self._parent = parent
        self.notebook = wx.Notebook(self, style=wx.BK_DEFAULT)
        self.buildSpec = buildSpec
        self.configPanels = configPanels
        self.options = list(self.buildSpec['widgets'].keys())
        self.layoutComponent()