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


Python wx.TRANSPARENT属性代码示例

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


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

示例1: _Draw

# 需要导入模块: import wx [as 别名]
# 或者: from wx import TRANSPARENT [as 别名]
def _Draw(self, dc , WorldToPixel, ScaleWorldToPixel, HTdc=None):
        XY = WorldToPixel(self.XY)
        dc.SetFont(self.Font)
        dc.SetTextForeground(self.Color)
        if self.BackgroundColor:
            dc.SetBackgroundMode(wx.SOLID)
            dc.SetTextBackground(self.BackgroundColor)
        else:
            dc.SetBackgroundMode(wx.TRANSPARENT)
        if self.TextWidth is None or self.TextHeight is None:
            (self.TextWidth, self.TextHeight) = dc.GetTextExtent(self.String)
        XY = self.ShiftFun(XY[0], XY[1], self.TextWidth, self.TextHeight)
        dc.DrawText(self.String, XY)
        if HTdc and self.HitAble:
            HTdc.SetPen(self.HitPen)
            HTdc.SetBrush(self.HitBrush)
            HTdc.DrawRectangle(XY, (self.TextWidth, self.TextHeight) ) 
开发者ID:dougthor42,项目名称:wafer_map,代码行数:19,代码来源:FCObjects.py

示例2: add_image

# 需要导入模块: import wx [as 别名]
# 或者: from wx import TRANSPARENT [as 别名]
def add_image(self, image):
        b = wx.BitmapFromImage(image)
        if not b.Ok():
            raise Exception("The image (%s) is not valid." % image)

        if (sys.platform == "darwin" and
            (b.GetWidth(), b.GetHeight()) == (self.icon_size, self.icon_size)):
            return self.il.Add(b)
        
        b2 = wx.EmptyBitmap(self.icon_size, self.icon_size)
        dc = wx.MemoryDC()
        dc.SelectObject(b2)
        dc.SetBackgroundMode(wx.TRANSPARENT)
        dc.Clear()
        x = (b2.GetWidth() - b.GetWidth()) / 2
        y = (b2.GetHeight() - b.GetHeight()) / 2
        dc.DrawBitmap(b, x, y, True)
        dc.SelectObject(wx.NullBitmap)
        b2.SetMask(wx.Mask(b2, (255, 255, 255)))

        return self.il.Add(b2)

    # Arrow drawing 
开发者ID:kenorb-contrib,项目名称:BitTorrent,代码行数:25,代码来源:ListCtrl.py

示例3: draw_sort_arrow

# 需要导入模块: import wx [as 别名]
# 或者: from wx import TRANSPARENT [as 别名]
def draw_sort_arrow(self, direction):
        b = wx.EmptyBitmap(self.icon_size, self.icon_size)
        w, h = b.GetSize()
        ho = (h - 5) / 2
        dc = wx.MemoryDC()
        dc.SelectObject(b)
        colour = wx.SystemSettings_GetColour(wx.SYS_COLOUR_GRAYTEXT)
        dc.SetBackgroundMode(wx.TRANSPARENT)
        dc.Clear()
        dc.SetPen(wx.Pen(colour))
        for i in xrange(5):
            if direction == 'down':
                j = 4 - i
            else:
                j = i
            dc.DrawLine(i,j+ho,9-i,j+ho)
        dc.SelectObject(wx.NullBitmap)
        b.SetMask(wx.Mask(b, (255, 255, 255)))
        return b 
开发者ID:kenorb-contrib,项目名称:BitTorrent,代码行数:21,代码来源:ListCtrl.py

示例4: on_paint

# 需要导入模块: import wx [as 别名]
# 或者: from wx import TRANSPARENT [as 别名]
def on_paint(self, event):
        dc = wx.PaintDC(self.widget)
        dc.SetBrush(wx.WHITE_BRUSH)
        dc.SetPen(wx.BLACK_PEN)
        dc.SetBackground(wx.WHITE_BRUSH)
        dc.Clear()
        w, h = self.widget.GetClientSize()
        dc.DrawLine(0, 0, w, h)
        dc.DrawLine(w, 0, 0, h)
        text = _('Custom Widget: %s') % self.instance_class
        tw, th = dc.GetTextExtent(text)
        x = (w - tw)//2
        y = (h - th)//2
        dc.SetPen(wx.ThePenList.FindOrCreatePen(wx.BLACK, 0, wx.TRANSPARENT))
        dc.DrawRectangle(x-1, y-1, tw+2, th+2)
        dc.DrawText(text, x, y) 
开发者ID:wxGlade,项目名称:wxGlade,代码行数:18,代码来源:custom_widget.py

示例5: on_paint

# 需要导入模块: import wx [as 别名]
# 或者: from wx import TRANSPARENT [as 别名]
def on_paint(self, event):
        dc = wx.PaintDC(self.widget)
        brush = wx.TheBrushList.FindOrCreateBrush( self.widget.GetBackgroundColour() )
        dc.SetBrush(brush)
        dc.SetPen(wx.ThePenList.FindOrCreatePen(wx.BLACK, 1, wx.SOLID))
        dc.SetBackground(brush)
        dc.Clear()
        w, h = self.widget.GetClientSize()
        dc.DrawLine(0, 0, w, h)
        dc.DrawLine(w, 0, 0, h)
        text = _('Spacer')
        tw, th = dc.GetTextExtent(text)
        x = (w - tw) // 2
        y = (h - th) // 2
        dc.SetPen(wx.ThePenList.FindOrCreatePen(wx.BLACK, 0, wx.TRANSPARENT))
        dc.DrawRectangle(x-1, y-1, tw+2, th+2)
        dc.DrawText(text, x, y) 
开发者ID:wxGlade,项目名称:wxGlade,代码行数:19,代码来源:spacer.py

示例6: _Draw

# 需要导入模块: import wx [as 别名]
# 或者: from wx import TRANSPARENT [as 别名]
def _Draw(self, dc, Canvas):
        """
        _Draw method for Overlay.

        .. note::
           This is a differeent signarture than the DrawObject Draw
        """
        dc.SetFont(self.Font)
        dc.SetTextForeground(self.Color)
        if self.BackgroundColor:
            dc.SetBackgroundMode(wx.SOLID)
            dc.SetTextBackground(self.BackgroundColor)
        else:
            dc.SetBackgroundMode(wx.TRANSPARENT)
        dc.DrawTextPoint(self.String, self.XY) 
开发者ID:dougthor42,项目名称:wafer_map,代码行数:17,代码来源:wm_legend.py

示例7: draw_rubberband

# 需要导入模块: import wx [as 别名]
# 或者: from wx import TRANSPARENT [as 别名]
def draw_rubberband(self, event, x0, y0, x1, y1):
        'adapted from http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/189744'
        canvas = self.canvas
        dc =wx.ClientDC(canvas)

        # Set logical function to XOR for rubberbanding
        dc.SetLogicalFunction(wx.XOR)

        # Set dc brush and pen
        # Here I set brush and pen to white and grey respectively
        # You can set it to your own choices

        # The brush setting is not really needed since we
        # dont do any filling of the dc. It is set just for
        # the sake of completion.

        wbrush =wx.Brush(wx.Colour(255,255,255), wx.TRANSPARENT)
        wpen =wx.Pen(wx.Colour(200, 200, 200), 1, wx.SOLID)
        dc.SetBrush(wbrush)
        dc.SetPen(wpen)


        dc.ResetBoundingBox()
        dc.BeginDrawing()
        height = self.canvas.figure.bbox.height
        y1 = height - y1
        y0 = height - y0

        if y1<y0: y0, y1 = y1, y0
        if x1<y0: x0, x1 = x1, x0

        w = x1 - x0
        h = y1 - y0

        rect = int(x0), int(y0), int(w), int(h)
        try: lastrect = self.lastrect
        except AttributeError: pass
        else: dc.DrawRectangle(*lastrect)  #erase last
        self.lastrect = rect
        dc.DrawRectangle(*rect)
        dc.EndDrawing() 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:43,代码来源:backend_wx.py

示例8: draw_blank

# 需要导入模块: import wx [as 别名]
# 或者: from wx import TRANSPARENT [as 别名]
def draw_blank(self):
        b = wx.EmptyBitmap(self.icon_size, self.icon_size)
        dc = wx.MemoryDC()
        dc.SelectObject(b)
        dc.SetBackgroundMode(wx.TRANSPARENT)
        dc.Clear()
        dc.SelectObject(wx.NullBitmap)
        b.SetMask(wx.Mask(b, (255, 255, 255)))
        return b

    # this builds an identical arrow to the windows listctrl arrows, in themed
    # and non-themed mode. 
开发者ID:kenorb-contrib,项目名称:BitTorrent,代码行数:14,代码来源:ListCtrl.py

示例9: Draw

# 需要导入模块: import wx [as 别名]
# 或者: from wx import TRANSPARENT [as 别名]
def Draw(
        self,
        dc,
        backgroundColour=(0, 0, 0),
        firstColour=(0, 0, 0),
        secondColour=(255, 255, 255),
        numBeams=16,
        radius=100.0,
        display=0, # deprecated
    ):
        dc.SetBackground(wx.Brush(backgroundColour))
        dc.Clear()
        w, h = dc.GetSizeTuple()
        gc = wx.GraphicsContext.Create(dc)
        gc.Translate(w / 2.0, h / 2.0)
        gc.Scale(1.0, 1.0)
        if radius == 0.0:
            r = max(w, h) * 2.0
        else:
            r = min(w, h) * (radius / 200.0)
        beamSize = (1.0 / numBeams) * math.pi * 2.0
        path = gc.CreatePath()
        for n in range(numBeams):
            phi1 = (n-0.25) * beamSize
            phi2 = (n+0.25) * beamSize
            path.MoveToPoint(0, 0)
            path.AddArc(0, 0, r, phi1, phi2)
            path.AddLineToPoint(0, 0)
            path.CloseSubpath()
        path2 = gc.CreatePath()
        path2.AddArc(0, 0, r, 0, math.pi * 2.0)
        gc.SetPen(wx.Pen("white", 1, style=wx.TRANSPARENT))
        gc.SetBrush(wx.Brush(firstColour))
        gc.FillPath(path2)
        gc.SetBrush(wx.Brush(secondColour))
        gc.FillPath(path) 
开发者ID:EventGhost,项目名称:EventGhost,代码行数:38,代码来源:__init__.py

示例10: _draw_ring_layer

# 需要导入模块: import wx [as 别名]
# 或者: from wx import TRANSPARENT [as 别名]
def _draw_ring_layer(self, dc, data, map_rel):
        """Draw a points layer.

        dc       the device context to draw on
        data     an iterable of point tuples:
                 (x, y, place, radius, colour, x_off, y_off, pdata)
        map_rel  points relative to map if True, MUST BE TRUE for lightweight
        Assumes all points are the same colour, saving 100's of ms.
        """

        assert map_rel is True
        if len(data) == 0:
            return
        (lon, lat, place, radius, colour, x_off, y_off, pdata) = data[0]

        scale = 2 ** self._pyslip.tiles.zoom_level

        # Draw points on map/view, using transparency if implemented.
        try:
            dc = wx.GCDC(dc)
        except NotImplementedError:
            pass
        dc.SetPen(wx.Pen(colour))
        dc.SetBrush(wx.Brush(colour, wx.TRANSPARENT))
        for (lon, lat, place, radius, colour, x_off, y_off, pdata) in data:
            (x, y) = self._pyslip.ConvertGeo2View((lon, lat))
            dc.DrawCircle(x, y, radius * scale) 
开发者ID:dials,项目名称:dials,代码行数:29,代码来源:ring_frame.py

示例11: _draw_rings_layer

# 需要导入模块: import wx [as 别名]
# 或者: from wx import TRANSPARENT [as 别名]
def _draw_rings_layer(self, dc, data, map_rel):
        """Draw a points layer.

        dc       the device context to draw on
        data     an iterable of point tuples:
                 (x, y, place, radius, colour, x_off, y_off, pdata)
        map_rel  points relative to map if True, MUST BE TRUE for lightweight
        Assumes all points are the same colour, saving 100's of ms.
        """

        assert map_rel is True
        if len(data) == 0:
            return
        (lon, lat, place, radius, colour, x_off, y_off, pdata) = data[0]

        scale = 2 ** self._pyslip.tiles.zoom_level

        # Draw points on map/view, using transparency if implemented.
        try:
            dc = wx.GCDC(dc)
        except NotImplementedError:
            pass
        dc.SetPen(wx.Pen(colour))
        dc.SetBrush(wx.Brush(colour, wx.TRANSPARENT))
        for (lon, lat, place, radius, colour, x_off, y_off, pdata) in data:
            (x, y) = self._pyslip.ConvertGeo2View((lon, lat))
            dc.DrawCircle(x, y, radius * scale) 
开发者ID:dials,项目名称:dials,代码行数:29,代码来源:uc_frame.py


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