當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。