Python wx 模块,FONTFAMILY_DEFAULT 实例源码

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

项目:irida-miseq-uploader    作者:phac-nml    | 项目源码 | 文件源码
def _post_processing_task_started(self):
        """Show a 'processing' message on the UI while the post processing task is executing."""
        pub.unsubscribe(self._post_processing_task_started, RunUploaderTopics.started_post_processing)
        pub.subscribe(self._post_processing_task_completed, RunUploaderTopics.finished_post_processing)
        pub.subscribe(self._post_processing_task_failed, RunUploaderTopics.failed_post_processing)
        logging.info("Post-processing started, updating UI.")

        self.Freeze()
        self._post_processing_sizer = wx.BoxSizer(wx.HORIZONTAL)
        self._post_processing_placeholder = ProcessingPlaceholderText(self)
        self._post_processing_placeholder.SetFont(wx.Font(pointSize=18, family=wx.FONTFAMILY_DEFAULT, style=wx.NORMAL, weight=wx.FONTWEIGHT_BOLD, face="Segoe UI Symbol"))
        self._post_processing_text = wx.StaticText(self, label="Executing post-processing task.")
        self._post_processing_text.SetFont(wx.Font(18, wx.DEFAULT, wx.NORMAL, wx.BOLD))
        self._post_processing_text.Wrap(350)
        self._post_processing_text.SetToolTipString("Executing command `{}`.".format(read_config_option("completion_cmd")))
        self._post_processing_sizer.Add(self._post_processing_text, flag=wx.RIGHT, border=5, proportion=1)
        self._post_processing_sizer.Add(self._post_processing_placeholder, flag=wx.LEFT, border=5, proportion=0)

        self._sizer.Insert(0, self._post_processing_sizer, flag=wx.EXPAND | wx.ALL, border=5)
        self.Layout()
        self.Thaw()
项目:imagepy    作者:Image-Py    | 项目源码 | 文件源码
def draw(self, dc, f, **key):
        dc.SetPen(wx.Pen((255,255,0), width=1, style=wx.SOLID))
        dc.SetTextForeground((255,255,0))
        font = wx.Font(8, wx.FONTFAMILY_DEFAULT, 
                       wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False)

        dc.SetFont(font)
        data = self.data[0 if len(self.data)==0 else key['cur']]

        pos = [f(*(i[0][1], i[0][0])) for i in data]
        for i in pos:dc.DrawCircle(i[0], i[1], 2)

        txts = ['id={}'.format(i) for i in range(len(data))]
        dc.DrawTextList(txts, pos)

        if data[0][1]==None:return
        lt = [f(*(i[1][1], i[1][0])) for i in data]
        rb = [f(*(i[1][3], i[1][2])) for i in data]
        rects = [(x1,y1,x2-x1,y2-y1) for (x1,y1),(x2,y2) in zip(*(lt,rb))]
        dc.DrawRectangleList(rects, brushes = wx.Brush((0,0,0), wx.BRUSHSTYLE_TRANSPARENT))
项目:imagepy    作者:Image-Py    | 项目源码 | 文件源码
def draw(self, dc, f, **key):
        dc.SetTextForeground((255,255,0))
        font = wx.Font(8, wx.FONTFAMILY_DEFAULT, 
                       wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False)
        dc.SetFont(font)

        dc.SetPen(wx.Pen((0,255,0), width=1, style=wx.SOLID))
        dc.SetBrush(wx.Brush((0,255,0)))
        pos = [f(*(i[1], i[0])) for i in self.xy[self.msk]]
        for i in pos:dc.DrawCircle(int(i[0]), int(i[1]), 2)


        dc.SetPen(wx.Pen((255,0,0), width=1, style=wx.SOLID))
        dc.SetBrush(wx.Brush((255,0,0)))
        pos = [f(*(i[1], i[0])) for i in self.xy[~self.msk]]
        for i in pos:dc.DrawCircle(int(i[0]), int(i[1]), 2)
项目:imagepy    作者:Image-Py    | 项目源码 | 文件源码
def draw(self, dc, f, **key):
        dc.SetPen(wx.Pen(Setting['color'], width=1, style=wx.SOLID))
        dc.SetTextForeground(Setting['tcolor'])
        linefont = wx.Font(8, wx.FONTFAMILY_DEFAULT, 
                           wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False)

        dc.SetFont(linefont)
        dc.DrawLines([f(*i) for i in self.buf])
        for i in self.buf:dc.DrawCircle(f(*i),2)
        for line in self.body:
            dc.DrawLines([f(*i) for i in line])
            for i in line:dc.DrawCircle(f(*i),2)
            pts = np.array(line)
            v1 = pts[:-2]-pts[1:-1]
            v2 = pts[2:]-pts[1:-1]
            a = np.sum(v1*v2, axis=1)*1.0
            a/=norm(v1,axis=1)*norm(v2,axis=1)
            ang = np.arccos(a)/np.pi*180
            for i,j in zip(ang,line[1:-1]):
                dc.DrawText('%.0f'%i, f(*j))
项目:imagepy    作者:Image-Py    | 项目源码 | 文件源码
def draw(self, dc, f, **key):
        dc.SetPen(wx.Pen(Setting['color'], width=1, style=wx.SOLID))
        dc.SetTextForeground(Setting['tcolor'])
        linefont = wx.Font(10, wx.FONTFAMILY_DEFAULT, 
                       wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False)
        dc.SetFont(linefont)
        dc.DrawLines([f(*i) for i in self.buf])
        for i in self.buf:dc.DrawCircle(f(*i),2)
        for line in self.body:
            dc.DrawLines([f(*i) for i in line])
            for i in line:dc.DrawCircle(f(*i),2)
            pts = np.array(line)
            mid = (pts[:-1]+pts[1:])/2

            dxy = (pts[:-1]-pts[1:])
            dxy[:,1][dxy[:,1]==0] = 1
            l = norm(dxy, axis=1)*-np.sign(dxy[:,1])
            ang = np.arccos(dxy[:,0]/l)/np.pi*180
            for i,j in zip(ang, mid):
                dc.DrawText('%.0f'%i, f(*j))
项目:imagepy    作者:Image-Py    | 项目源码 | 文件源码
def draw(self, dc, f, **key):
        dc.SetPen(wx.Pen(Setting['color'], width=1, style=wx.SOLID))
        dc.SetTextForeground(Setting['tcolor'])
        font = wx.Font(10, wx.FONTFAMILY_DEFAULT, 
                       wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False)

        dc.SetFont(font)
        dc.DrawLines([f(*i) for i in self.buf])
        for i in self.buf:dc.DrawCircle(f(*i),2)

        for pg in self.body:
            plg = Polygon(pg)
            dc.DrawLines([f(*i) for i in pg])
            for i in pg: dc.DrawCircle(f(*i),2)
            area, xy = plg.area, plg.centroid
            if self.unit!=None: 
                area *= self.unit[0]**2
            dc.DrawText('%.1f'%area, f(xy.x, xy.y))
项目:imagepy    作者:Image-Py    | 项目源码 | 文件源码
def draw(self, dc, f, **key):
        dc.SetPen(wx.Pen(Setting['color'], width=1, style=wx.SOLID))
        dc.SetTextForeground(Setting['tcolor'])
        linefont = wx.Font(10, wx.FONTFAMILY_DEFAULT, 
                       wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False)
        dc.SetFont(linefont)
        if len(self.buf)>1:
            dc.DrawLines([f(*i) for i in self.buf])
        for i in self.buf:dc.DrawCircle(f(*i),2)
        for line in self.body:
            dc.DrawLines([f(*i) for i in line])
            for i in line:dc.DrawCircle(f(*i),2)
            pts = np.array(line)
            mid = (pts[:-1]+pts[1:])/2

            dxy = (pts[:-1]-pts[1:])
            dis = norm(dxy, axis=1)
            unit = 1 if self.unit is None else self.unit[0]
            for i,j in zip(dis, mid):
                dc.DrawText('%.2f'%(i*unit), f(*j))
项目:Cognitive-Face-Python    作者:Microsoft    | 项目源码 | 文件源码
def __init__(self, parent):
        super(MyTitle, self).__init__(parent)
        self.SetBackgroundColour('#00b294')
        self.SetMinSize((-1, 80))

        sizer = wx.BoxSizer()
        sizer.AddStretchSpacer()

        family = wx.FONTFAMILY_DEFAULT
        style = wx.FONTSTYLE_NORMAL
        weight = wx.FONTWEIGHT_NORMAL
        font = wx.Font(20, family, style, weight)
        self.text = wx.StaticText(self, label=TITLE, style=wx.ALIGN_CENTER)
        self.text.SetFont(font)
        sizer.Add(self.text, flag=wx.ALIGN_CENTER_VERTICAL)

        sizer.AddStretchSpacer()
        self.SetSizer(sizer)
项目:GRIPy    作者:giruenf    | 项目源码 | 文件源码
def OnDrawItem(self, dc, rect, item, flags):
        if item == wx.NOT_FOUND:
            # painting the control, but there is no valid item selected yet
            return 
        font = wx.Font(8, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, 'Segoe UI')             
        dc.SetFont(font)
        if flags == 3:
            margin = 3    
        else:
            margin = 1
        r = wx.Rect(*rect)  # make a copy
        r.Deflate(margin, margin)
        tam = self.OnMeasureItem(item)-2
        dc.SetPen(wx.Pen("grey", style=wx.TRANSPARENT))
        color_name = self.GetString(item)     
        color = self.colors.get(color_name)
        if not color:
            color = wx.NamedColour(color_name)
        dc.SetBrush(wx.Brush(color))
        dc.DrawRectangle(r.x, r.y, tam, tam)
        dc.DrawText(self.GetString(item), r.x + tam + 2, r.y)
项目:irida-miseq-uploader    作者:phac-nml    | 项目源码 | 文件源码
def __init__(self, parent, *args, **kwargs):
        wx.StaticText.__init__(self, parent, *args, **kwargs)
        self._timer = wx.Timer(self)
        self._current_char = 0

        # this is the only font face on windows that actually renders the clock faces correctly.
        self.SetFont(wx.Font(pointSize=wx.DEFAULT, family=wx.FONTFAMILY_DEFAULT, style=wx.NORMAL, weight=wx.FONTWEIGHT_NORMAL, face="Segoe UI Symbol"))

        self.Bind(wx.EVT_TIMER, self._update_progress_text, self._timer)
        self.Restart()
项目:imagepy    作者:Image-Py    | 项目源码 | 文件源码
def draw_coord(self, dc, w, h, l, t, r, b):
        xs = [5, 10, 20, 40, 50, 100, 200, 400, 500, 1000, 2000, 4000, 10000]
        n, dx, dy = len(self.data), 0, 0
        left, low, right, high = self.extent
        for i in xs[::-1]: 
            if (right-left)*1.0/i<=10:dx=i
        for i in xs[::-1]: 
            if (high-low)*1.0/i<=10:dy=i
        dc.SetPen(wx.Pen((0, 0, 0), width=1, style=wx.SOLID))
        dc.DrawRectangle(l, t, w+1, h+1)
        dc.SetPen(wx.Pen((100, 100, 100), width=1, style=wx.SOLID))
        for i in range(int(ceil(left*1.0/dx)*dx), int(right)+1, dx):
            x = l+(i-left)*1.0/(right-left)*w
            dc.DrawLine(x, t, x, t+h)
            dc.DrawText(str(i), x-5, t+h)
        for i in range(int(ceil(low*1.0/dy)*dy), int(high)+1, dy):
            y = h+t-(i-low)*1.0/(high-low)*h
            dc.DrawLine(l, y, l+w, y)
            dc.DrawText(str(i), 5, y-5)

        titlefont = wx.Font(18, wx.FONTFAMILY_DEFAULT, 
                       wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False)
        dc.SetFont(titlefont)
        dw,dh = dc.GetTextExtent(self.title)
        dc.DrawText(self.title, l+w/2-dw/2, 3)

        lablelfont = wx.Font(14, wx.FONTFAMILY_DEFAULT, 
                       wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False)
        dc.SetFont(lablelfont)
        dw,dh = dc.GetTextExtent(self.labelx)
        dc.DrawText(self.labelx, l+w-dw, t+h+15)
        dc.DrawText(self.labely, 5, 10)
项目:imagepy    作者:Image-Py    | 项目源码 | 文件源码
def draw(self, dc, f, **key):
        dc.SetPen(wx.Pen((255,255,0), width=3, style=wx.SOLID))
        dc.SetTextForeground((255,255,0))
        font = wx.Font(8, wx.FONTFAMILY_DEFAULT, 
                       wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False)
        dc.SetFont(font)

        ids = self.graph.nodes()
        pts = [self.graph.node[i]['o'] for i in ids]
        pts = [f(i[1], i[0]) for i in pts]
        dc.DrawPointList(pts)
        dc.DrawTextList([str(i) for i in ids], pts)
项目:imagepy    作者:Image-Py    | 项目源码 | 文件源码
def draw(self, dc, f, **key):
        dc.SetPen(wx.Pen(Setting['color'], width=1, style=wx.SOLID))
        dc.SetTextForeground(Setting['tcolor'])
        font = wx.Font(10, wx.FONTFAMILY_DEFAULT, 
                       wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False)

        dc.SetFont(font)
        for i in self.body:
            x,y = f(*i)
            unit = 1 if self.unit is None else self.unit[0]
            dc.DrawCircle(x, y, 2)
            dc.DrawText('(%.1f,%.1f)'%(i[0]*unit, i[1]*unit), x, y)
项目:Cognitive-Face-Python    作者:Microsoft    | 项目源码 | 文件源码
def draw_bitmap_rectangle(bitmap, faces):
    """Draw rectangle on bitmap."""
    dc = wx.MemoryDC(bitmap.bmp)
    dc.SetPen(wx.BLUE_PEN)
    dc.SetBrush(wx.TRANSPARENT_BRUSH)
    dc.SetTextBackground('black')
    dc.SetTextForeground('white')
    dc.SetBackgroundMode(wx.SOLID)
    dc.SetFont(wx.Font(8,
                       wx.FONTFAMILY_DEFAULT,
                       wx.FONTSTYLE_NORMAL,
                       wx.FONTWEIGHT_BOLD))
    for face in faces:
        dc.DrawRectangle(
            face.rect.left * bitmap.scale,
            face.rect.top * bitmap.scale,
            face.rect.width * bitmap.scale,
            face.rect.height * bitmap.scale,
        )
        if face.name:
            text_width, text_height = dc.GetTextExtent(face.name)
            dc.DrawText(face.name,
                        face.rect.left * bitmap.scale,
                        face.rect.top * bitmap.scale - text_height)
    dc.SelectObject(wx.NullBitmap)
    bitmap.bitmap.SetBitmap(bitmap.bmp)
项目:mobileinsight-core    作者:mobile-insight    | 项目源码 | 文件源码
def __init__(self, parent, start_time, end_time):
        wx.Dialog.__init__(self, parent, -1)
        sizer = wx.BoxSizer(wx.VERTICAL)
        self.SetTitle("Time Window")
        self.start_label = wx.StaticText(self, -1, label="...", style=wx.BOLD)
        self.end_label = wx.StaticText(self, -1, label="...", style=wx.BOLD)
        self.window_label = wx.StaticText(self, -1, "\t to \t")
        # self.start_label.SetFont(wx.Font(11, wx.DEFAULT, wx.BOLD, wx.NORMAL))
        # self.window_label.SetFont(wx.Font(11, wx.DEFAULT, wx.ITALIC, wx.NORMAL))
        # self.end_label.SetFont(wx.Font(11, wx.DEFAULT, wx.BOLD, wx.NORMAL))

        self.start_label.SetFont(wx.Font(11, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_SLANT, wx.FONTWEIGHT_NORMAL))
        self.window_label.SetFont(wx.Font(11, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_ITALIC, wx.FONTWEIGHT_NORMAL))
        self.end_label.SetFont(wx.Font(11, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_SLANT, wx.FONTWEIGHT_NORMAL))

        labelSizer = wx.BoxSizer(wx.HORIZONTAL)
        labelSizer.Add(self.start_label, 0, wx.ALL | wx.EXPAND, 3)
        labelSizer.Add(self.window_label, wx.ALL, 1)
        labelSizer.Add(self.end_label, 0, wx.ALL | wx.EXPAND, 3)

        self.btns = self.CreateSeparatedButtonSizer(wx.OK | wx.CANCEL)
        start_sizer = wx.BoxSizer(wx.HORIZONTAL)
        start_sizer.Add(wx.StaticText(self, -1, "Start: "), 0, wx.ALL, 1)
        self.start_slider = wx.Slider(
            self, -1, 0, 0, 100, wx.DefaultPosition, (250, -1), wx.SL_HORIZONTAL)
        start_sizer.Add(self.start_slider, 0, wx.ALL | wx.EXPAND, 5)
        self.Bind(wx.EVT_SLIDER, self.start_slider_update, self.start_slider)

        end_sizer = wx.BoxSizer(wx.HORIZONTAL)
        end_sizer.Add(wx.StaticText(self, -1, "End: "), 0, wx.ALL, 1)
        self.end_slider = wx.Slider(
            self, -1, 100, 0, 100, wx.DefaultPosition, (250, -1), wx.SL_HORIZONTAL)
        end_sizer.Add(self.end_slider, 0, wx.ALL | wx.EXPAND, 5)
        self.Bind(wx.EVT_SLIDER, self.end_slider_udpate, self.end_slider)

        self.start_time = start_time
        self.cur_end = end_time
        self.cur_start = self.start_time
        self.unit_seconds = (end_time - start_time).total_seconds() / 100.0

        self.updateUI()
        sizer.Add(labelSizer, 0, wx.ALL | wx.EXPAND, 5)
        sizer.Add(start_sizer, 0, wx.ALL | wx.EXPAND, 5)
        sizer.Add(end_sizer, 0, wx.ALL | wx.EXPAND, 5)
        sizer.Add(self.btns, 0, wx.ALL | wx.EXPAND, 5)
        self.SetSizer(sizer)
        self.Fit()
项目:imagepy    作者:Image-Py    | 项目源码 | 文件源码
def draw(self, dc, f, **key):
        dc.SetPen(wx.Pen((255,255,0), width=1, style=wx.SOLID))
        dc.SetTextForeground((255,255,0))
        font = wx.Font(8, wx.FONTFAMILY_DEFAULT, 
                       wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False)

        dc.SetFont(font)
        data = self.data[0 if len(self.data)==1 else key['cur']]

        for i in range(len(data)):
            pos = f(*(data[i][0], data[i][1]))
            dc.SetBrush(wx.Brush((255,255,255)))
            dc.DrawCircle(pos[0], pos[1], 2)
            dc.SetBrush(wx.Brush((0,0,0), wx.BRUSHSTYLE_TRANSPARENT))
            dc.DrawCircle(pos[0], pos[1], data[i][2]*key['k'])
            dc.DrawText('id={}, r={}'.format(i, data[i][2]), pos[0], pos[1])