当前位置: 首页>>代码示例>>Python>>正文


Python wx.ScreenDC方法代码示例

本文整理汇总了Python中wx.ScreenDC方法的典型用法代码示例。如果您正苦于以下问题:Python wx.ScreenDC方法的具体用法?Python wx.ScreenDC怎么用?Python wx.ScreenDC使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在wx的用法示例。


在下文中一共展示了wx.ScreenDC方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: ComputeFontScale

# 需要导入模块: import wx [as 别名]
# 或者: from wx import ScreenDC [as 别名]
def ComputeFontScale():
    """
    Compute the font scale.
    
    A global variable to hold the scaling from pixel size to point size.
    """
    global FontScale
    dc = wx.ScreenDC()
    dc.SetFont(wx.Font(16, wx.FONTFAMILY_ROMAN, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL))
    E = dc.GetTextExtent("X")
    FontScale = 16/E[1]
    del dc

# why do we do this here, causes a Sphinx build crash
#ComputeFontScale()    

## fixme: This should probably be re-factored into a class 
开发者ID:dougthor42,项目名称:wafer_map,代码行数:19,代码来源:FCObjects.py

示例2: OnPaint

# 需要导入模块: import wx [as 别名]
# 或者: from wx import ScreenDC [as 别名]
def OnPaint(self, evt):
            dc = wx.PaintDC(self)
            inset = (20, 20, 20, 20)
            rect = [inset[0], inset[1], self.GetSize().width-(inset[0]+inset[2]), self.GetSize().height-(inset[1]+inset[3])]

            # Calculate exactly how high the wrapped is going to be and put a frame around it.
            dc.SetFont(self.font)
            dc.SetPen(wx.RED_PEN)
            rect[3] = WordWrapRenderer.CalculateHeight(dc, self.text, rect[2])
            dc.DrawRectangle(*rect)
            WordWrapRenderer.DrawString(dc, self.text, rect, wx.ALIGN_LEFT)
            #WordWrapRenderer.DrawTruncatedString(dc, self.text, rect, wx.ALIGN_CENTER_HORIZONTAL,s ellipse=wx.CENTER)

            #bmp = wx.EmptyBitmap(rect[0]+rect[2], rect[1]+rect[3])
            #mdc = wx.MemoryDC(bmp)
            #mdc.SetBackground(wx.Brush("white"))
            #mdc.Clear()
            #mdc.SetFont(self.font)
            #mdc.SetPen(wx.RED_PEN)
            #rect[3] = WordWrapRenderer.CalculateHeight(mdc, self.text, rect[2])
            #mdc.DrawRectangle(*rect)
            #WordWrapRenderer.DrawString(mdc, self.text, rect, wx.ALIGN_LEFT)
            #del mdc
            #dc = wx.ScreenDC()
            #dc.DrawBitmap(bmp, 20, 20) 
开发者ID:JackonYang,项目名称:bookhub,代码行数:27,代码来源:WordWrapRenderer.py

示例3: get_text_size

# 需要导入模块: import wx [as 别名]
# 或者: from wx import ScreenDC [as 别名]
def get_text_size(text, font):
    dc = wx.ScreenDC()
    dc.SetFont(font)
    return dc.GetTextExtent(text) 
开发者ID:EarToEarOak,项目名称:RF-Monitor,代码行数:6,代码来源:utils_wx.py

示例4: saveImage

# 需要导入模块: import wx [as 别名]
# 或者: from wx import ScreenDC [as 别名]
def saveImage(canvas, filename):
    s = wx.ScreenDC()
    w, h = canvas.size.Get()
    b = wx.EmptyBitmap(w, h)
    m = wx.MemoryDCFromDC(s)
    m.SelectObject(b)
    m.Blit(0, 0, w, h, s, 70, 0)
    m.SelectObject(wx.NullBitmap)
    b.SaveFile(filename, wx.BITMAP_TYPE_PNG) 
开发者ID:bmershon,项目名称:laplacian-meshes,代码行数:11,代码来源:MeshCanvas.py

示例5: FontForLabels

# 需要导入模块: import wx [as 别名]
# 或者: from wx import ScreenDC [as 别名]
def FontForLabels(self, dc):
        ''' Return the default GUI font, scaled for printing if necessary. '''
        font = wx.SystemSettings_GetFont(wx.SYS_DEFAULT_GUI_FONT)
        scale = dc.GetPPI()[0] / wx.ScreenDC().GetPPI()[0]
        font.SetPointSize(scale*font.GetPointSize())
        return font 
开发者ID:lrq3000,项目名称:pyFileFixity,代码行数:8,代码来源:squaremap.py

示例6: GetBestSize

# 需要导入模块: import wx [as 别名]
# 或者: from wx import ScreenDC [as 别名]
def GetBestSize(self):
        if not self.__radio_size:
            dc = wx.ScreenDC()
            dc.SetFont(compat.wx_SystemSettings_GetFont(wx.SYS_DEFAULT_GUI_FONT))
            self.__radio_size = (3*dc.GetCharHeight())//2
        label = self.GetLabel()
        if label:
            w, h = self.GetTextExtent(label)
            w += self.__radio_size + self.GetCharWidth()
            if h < self.__radio_size:
                h = self.__radio_size
        else:
            w = h = self.__radio_size
        return w, h 
开发者ID:wxGlade,项目名称:wxGlade,代码行数:16,代码来源:misc.py


注:本文中的wx.ScreenDC方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。