Python wx 模块,MODERN 实例源码

我们从Python开源项目中,提取了以下5个代码示例,用于说明如何使用wx.MODERN

项目:fritzchecksum    作者:mementum    | 项目源码 | 文件源码
def __init__(self, parent):
        maingui.AboutDialog.__init__(self, parent)
        self.font = wx.Font(10, wx.MODERN, wx.NORMAL, wx.NORMAL, False, u'Consolas')
        self.FillPanelAbout()
        self.AddDocuments()
        self.Fit() # Ensure the Dialog resizes to fit the added Panels
        self.Centre()
项目:Jackal_Velodyne_Duke    作者:MengGuo    | 项目源码 | 文件源码
def __set_properties(self):
        # begin wxGlade: TerminalFrame.__set_properties
        self.SetTitle("Serial Terminal")
        self.SetSize((546, 383))
        self.text_ctrl_output.SetFont(wx.Font(9, wx.MODERN, wx.NORMAL, wx.NORMAL, 0, ""))
        # end wxGlade
项目:beremiz    作者:nucleron    | 项目源码 | 文件源码
def DoDrawing(self, dc, printing=False):
        if printing:
            if getattr(dc, "printing", False):
                font = wx.Font(self.GetFont().GetPointSize(), wx.MODERN, wx.NORMAL, wx.NORMAL)
                dc.SetFont(font)
            else:
                dc.SetFont(self.GetFont())
        else:
            dc.SetBackground(wx.Brush(self.Editor.GetBackgroundColour()))
            dc.Clear()
            dc.BeginDrawing()
        if self.Scaling is not None and self.DrawGrid and not printing:
            dc.SetPen(wx.TRANSPARENT_PEN)
            dc.SetBrush(self.GridBrush)
            xstart, ystart = self.GetViewStart()
            window_size = self.Editor.GetClientSize()
            width, height = self.Editor.GetVirtualSize()
            width = int(max(width, xstart * SCROLLBAR_UNIT + window_size[0]) / self.ViewScale[0])
            height = int(max(height, ystart * SCROLLBAR_UNIT + window_size[1]) / self.ViewScale[1])
            dc.DrawRectangle(1, 1, width, height)
        if self.PageSize is not None and not printing:
            dc.SetPen(self.PagePen)
            xstart, ystart = self.GetViewStart()
            window_size = self.Editor.GetClientSize()
            for x in xrange(self.PageSize[0] - (xstart * SCROLLBAR_UNIT) % self.PageSize[0], int(window_size[0] / self.ViewScale[0]), self.PageSize[0]):
                dc.DrawLine(xstart * SCROLLBAR_UNIT + x + 1, int(ystart * SCROLLBAR_UNIT / self.ViewScale[0]),
                            xstart * SCROLLBAR_UNIT + x + 1, int((ystart * SCROLLBAR_UNIT + window_size[1]) / self.ViewScale[0]))
            for y in xrange(self.PageSize[1] - (ystart * SCROLLBAR_UNIT) % self.PageSize[1], int(window_size[1] / self.ViewScale[1]), self.PageSize[1]):
                dc.DrawLine(int(xstart * SCROLLBAR_UNIT / self.ViewScale[0]), ystart * SCROLLBAR_UNIT + y + 1,
                            int((xstart * SCROLLBAR_UNIT + window_size[0]) / self.ViewScale[1]), ystart * SCROLLBAR_UNIT + y + 1)

        # Draw all elements
        for comment in self.Comments.itervalues():
            if comment != self.SelectedElement and (comment.IsVisible() or printing):
                comment.Draw(dc)
        for wire in self.Wires.iterkeys():
            if wire != self.SelectedElement and (wire.IsVisible() or printing):
                if not self.Debug or not wire.GetValue():
                    wire.Draw(dc)
        if self.Debug:
            for wire in self.Wires.iterkeys():
                if wire != self.SelectedElement and (wire.IsVisible() or printing) and wire.GetValue():
                    wire.Draw(dc)
        for block in self.Blocks.itervalues():
            if block != self.SelectedElement and (block.IsVisible() or printing):
                block.Draw(dc)

        if self.SelectedElement is not None and (self.SelectedElement.IsVisible() or printing):
            self.SelectedElement.Draw(dc)

        if not printing:
            if self.Debug:
                self.InstanceName.Draw(dc)
            if self.rubberBand.IsShown():
                self.rubberBand.Draw(dc)
            dc.EndDrawing()
项目:hco-experiments    作者:zooniverse    | 项目源码 | 文件源码
def create_main_panel(self):

        self.panel = wx.Panel(self)
        self.set_text = wx.StaticText(self.panel, -1, label="Showing : All (%d examples)" % self.m)
        self.set_text.SetBackgroundColour(wx.WHITE)
        font = wx.Font(20, wx.MODERN, wx.NORMAL, wx.BOLD)
        self.set_text.SetFont(font)

        self.hbox1 = wx.BoxSizer(wx.HORIZONTAL)
        self.hbox1.Add(self.set_text, border=5, flag=wx.ALL | wx.ALIGN_CENTER_VERTICAL)

        self.draw_fig(True)
        self.canvas = FigCanvas(self.panel, -1, self.fig)

        # Bind the 'click' event for clicking on one of the axes
        self.canvas.mpl_connect('button_press_event', self.on_click)
        self.navigation_control = NavigationControlBox(self.panel, self, -1, "navigation control")
        #self.label_key_box = LabelKeyBox(self.panel,-1)
        self.data_set_control = DataSetControlBox(self.panel,self,-1)

        self.build_button = wx.Button(self.panel, -1, label="Build")
        self.build_button.Bind(wx.EVT_BUTTON, self.on_build)
        self.reset_button = wx.Button(self.panel, -1, label="Reset")
        self.reset_button.Bind(wx.EVT_BUTTON, self.on_reset)
        self.exit_button = wx.Button(self.panel, -1, label="Exit")
        self.exit_button.Bind(wx.EVT_BUTTON, self.on_exit)

        self.vbox1 = wx.BoxSizer(wx.VERTICAL)
        self.vbox1.Add(self.build_button, 0, flag=wx.CENTER | wx.BOTTOM)
        self.vbox1.Add(self.reset_button, 0, flag=wx.CENTER | wx.BOTTOM)
        self.vbox1.Add(self.exit_button, 0, flag=wx.CENTER | wx.BOTTOM)

        self.hbox2 = wx.BoxSizer(wx.HORIZONTAL)
        #self.hbox2.Add(self.label_key_box, border=5, flag=wx.ALL | wx.ALIGN_CENTER_VERTICAL)
        self.hbox2.Add(self.data_set_control, border=5, flag=wx.ALL | wx.ALIGN_CENTER_VERTICAL)
        self.hbox2.Add(self.navigation_control, border=5, flag=wx.ALL | wx.ALIGN_CENTER_VERTICAL)
        self.hbox2.Add(self.vbox1, border=5, flag=wx.ALL | wx.ALIGN_CENTER_VERTICAL)

        self.vbox2 = wx.BoxSizer(wx.VERTICAL)
        self.vbox2.Add(self.hbox1, 0, flag=wx.CENTER | wx.TOP)
        self.vbox2.Add(self.canvas, 1, flag=wx.CENTER | wx.CENTER | wx.GROW)
        self.vbox2.Add(self.hbox2, 0, flag=wx.LEFT | wx.TOP)

        self.panel.SetSizer(self.vbox2)
        self.vbox2.Fit(self)
项目:hco-experiments    作者:zooniverse    | 项目源码 | 文件源码
def create_main_panel(self):

        self.panel = wx.Panel(self)
        self.set_text = wx.StaticText(self.panel, -1, label="Showing : All (%d examples)" % self.m)
        self.set_text.SetBackgroundColour(wx.WHITE)
        font = wx.Font(20, wx.MODERN, wx.NORMAL, wx.BOLD)
        self.set_text.SetFont(font)

        self.hbox1 = wx.BoxSizer(wx.HORIZONTAL)
        self.hbox1.Add(self.set_text, border=5, flag=wx.ALL | wx.ALIGN_CENTER_VERTICAL)

        self.draw_fig(True)
        self.canvas = FigCanvas(self.panel, -1, self.fig)

        # Bind the 'click' event for clicking on one of the axes
        self.canvas.mpl_connect('button_press_event', self.on_click)
        self.navigation_control = NavigationControlBox(self.panel, self, -1, "navigation control")
        #self.label_key_box = LabelKeyBox(self.panel,-1)
        self.data_set_control = DataSetControlBox(self.panel,self,-1)

        self.build_button = wx.Button(self.panel, -1, label="Build")
        self.build_button.Bind(wx.EVT_BUTTON, self.on_build)
        self.reset_button = wx.Button(self.panel, -1, label="Reset")
        self.reset_button.Bind(wx.EVT_BUTTON, self.on_reset)
        self.exit_button = wx.Button(self.panel, -1, label="Exit")
        self.exit_button.Bind(wx.EVT_BUTTON, self.on_exit)

        self.vbox1 = wx.BoxSizer(wx.VERTICAL)
        self.vbox1.Add(self.build_button, 0, flag=wx.CENTER | wx.BOTTOM)
        self.vbox1.Add(self.reset_button, 0, flag=wx.CENTER | wx.BOTTOM)
        self.vbox1.Add(self.exit_button, 0, flag=wx.CENTER | wx.BOTTOM)

        self.hbox2 = wx.BoxSizer(wx.HORIZONTAL)
        #self.hbox2.Add(self.label_key_box, border=5, flag=wx.ALL | wx.ALIGN_CENTER_VERTICAL)
        self.hbox2.Add(self.data_set_control, border=5, flag=wx.ALL | wx.ALIGN_CENTER_VERTICAL)
        self.hbox2.Add(self.navigation_control, border=5, flag=wx.ALL | wx.ALIGN_CENTER_VERTICAL)
        self.hbox2.Add(self.vbox1, border=5, flag=wx.ALL | wx.ALIGN_CENTER_VERTICAL)

        self.vbox2 = wx.BoxSizer(wx.VERTICAL)
        self.vbox2.Add(self.hbox1, 0, flag=wx.CENTER | wx.TOP)
        self.vbox2.Add(self.canvas, 1, flag=wx.CENTER | wx.CENTER | wx.GROW)
        self.vbox2.Add(self.hbox2, 0, flag=wx.LEFT | wx.TOP)

        self.panel.SetSizer(self.vbox2)
        self.vbox2.Fit(self)