本文整理汇总了Python中wx.BLACK_PEN属性的典型用法代码示例。如果您正苦于以下问题:Python wx.BLACK_PEN属性的具体用法?Python wx.BLACK_PEN怎么用?Python wx.BLACK_PEN使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类wx
的用法示例。
在下文中一共展示了wx.BLACK_PEN属性的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: on_paint
# 需要导入模块: import wx [as 别名]
# 或者: from wx import BLACK_PEN [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)
示例2: process_draw
# 需要导入模块: import wx [as 别名]
# 或者: from wx import BLACK_PEN [as 别名]
def process_draw(self, gc):
if self.scene.device.draw_mode & DRAW_MODE_GRID != 0:
return
device = self.scene.device
if device is not None:
wmils = device.bed_width * MILS_IN_MM
hmils = device.bed_height * MILS_IN_MM
else:
wmils = 320 * MILS_IN_MM
hmils = 220 * MILS_IN_MM
background = self.background
if background is None:
gc.SetBrush(wx.WHITE_BRUSH)
gc.DrawRectangle(0, 0, wmils, hmils)
elif isinstance(background, int):
gc.SetBrush(wx.Brush(wx.Colour(swizzlecolor(background))))
gc.DrawRectangle(0, 0, wmils, hmils)
else:
gc.DrawBitmap(background, 0, 0, wmils, hmils)
if self.grid is None:
self.calculate_grid()
starts, ends = self.grid
gc.SetPen(wx.BLACK_PEN)
gc.StrokeLineSegments(starts, ends)
示例3: OnPaintButton
# 需要导入模块: import wx [as 别名]
# 或者: from wx import BLACK_PEN [as 别名]
def OnPaintButton(self, evt):
dc = wx.PaintDC(self.button)
dc.SetBrush(wx.TRANSPARENT_BRUSH)
if self.IsEnabled(): dc.SetPen(wx.BLACK_PEN)
else: dc.SetPen(wx.GREY_PEN)
size = self.button.GetSize()
dc.DrawRectangle(0, 0, size.width, size.height)
示例4: OnPaint
# 需要导入模块: import wx [as 别名]
# 或者: from wx import BLACK_PEN [as 别名]
def OnPaint(self, event):
"""
Callback for Paint Event
@param event: Paint event
"""
# Get buffered paint DC for tool tip
dc = wx.AutoBufferedPaintDC(self)
dc.Clear()
# Set DC drawing style
dc.SetPen(wx.BLACK_PEN)
dc.SetBrush(wx.Brush(wx.Colour(255, 238, 170)))
dc.SetFont(self.Font)
# Draw Tool tip
dc.BeginDrawing()
tip_width, tip_height = self.GetToolTipSize()
# Draw background rectangle
dc.DrawRectangle(0, 0, tip_width, tip_height)
# Draw tool tip text
line_offset = 0
for line in self.Tip:
dc.DrawText(line, 2, line_offset + 2)
_line_width, line_height = dc.GetTextExtent(line)
line_offset += line_height
dc.EndDrawing()
event.Skip()
示例5: run
# 需要导入模块: import wx [as 别名]
# 或者: from wx import BLACK_PEN [as 别名]
def run(self):
printer = OLVPrinter(self.olv, "First ObjectListView Report")
printer.ReportFormat = ReportFormat.Normal()
#fmt.PageHeader.Font = wx.FFont(36, wx.FONTFAMILY_SWISS, face="Gill Sans")
#fmt.PageHeader.Add(BackgroundDecoration(wx.BLUE))
#fmt.PageHeader.Add(LineDecoration(side=Decoration.TOP, pen=wx.Pen(wx.RED, 5), space=0))
#fmt.PageHeader.Add(LineDecoration(pen=wx.BLACK_PEN, space=0))
#
#fmt.PageFooter.Font = wx.FFont(12, wx.FONTFAMILY_SWISS, face="Gill Sans")
#fmt.PageFooter.Add(BackgroundDecoration(wx.GREEN))
#fmt.PageFooter.Add(LineDecoration(pen=wx.Pen(wx.BLUE, 5), space=0))
#fmt.PageFooter.Add(LineDecoration(side=Decoration.TOP, pen=wx.RED_PEN, space=0))
printer.PrintPreview(self)
示例6: OnPaint
# 需要导入模块: import wx [as 别名]
# 或者: from wx import BLACK_PEN [as 别名]
def OnPaint(self, event):
dc = wx.BufferedPaintDC(self, self.screenBuf)
size = self.GetClientSize()
dc.SetBrush(wx.WHITE_BRUSH)
dc.SetPen(wx.WHITE_PEN)
dc.DrawRectangle(0, 0, size.width, size.height)
dc.SetPen(wx.BLACK_PEN)
dc.SetTextForeground(wx.BLACK)
for y in range(self.rows + 1):
util.drawLine(dc, self.offset, self.offset + y * self.cellSize,
self.cols * self.cellSize + 1, 0)
for x in range(self.cols + 1):
util.drawLine(dc, self.offset + x * self.cellSize,
self.offset, 0, self.rows * self.cellSize)
dc.SetFont(self.normalFont)
for y in range(self.rows):
for x in range(self.cols):
i = y * self.cols + x
if i < len(self.chars):
util.drawText(dc, self.chars[i],
x * self.cellSize + self.offset + self.cellSize // 2 + 1,
y * self.cellSize + self.offset + self.cellSize // 2 + 1,
util.ALIGN_CENTER, util.VALIGN_CENTER)
y = self.offset + self.rows * self.cellSize
pad = 5
if self.selected:
code = ord(self.selected)
self.drawCharBox(dc, "Selected:", self.selected, self.offset,
y + pad, 75)
c = util.upper(self.selected)
if c == self.selected:
c = util.lower(self.selected)
if c == self.selected:
c = None
if c:
self.drawCharBox(dc, "Opposite case:", c, self.offset + 150,
y + pad, 110)
dc.SetFont(self.smallFont)
dc.DrawText("Character code: %d" % code, 360, y + pad)
if code == 32:
dc.DrawText("Normal space", 360, y + pad + 30)
elif code == 160:
dc.DrawText("Non-breaking space", 360, y + pad + 30)
else:
dc.SetFont(self.smallFont)
dc.DrawText("Click on a character to select it.", self.offset,
y + pad)
示例7: DrawSelf
# 需要导入模块: import wx [as 别名]
# 或者: from wx import BLACK_PEN [as 别名]
def DrawSelf(self, dc, bounds):
"""
Do the actual work of rendering this block.
"""
cellFmt = self.GetFormat()
cellPadding = self._CalculateCellPadding(cellFmt)
combined = self.GetCombinedLists()
# Calculate cell boundaries
cell = list(bounds)
cell[2] = 0
for x in combined:
RectUtils.SetLeft(cell, RectUtils.Right(cell))
RectUtils.SetWidth(cell, x.cellWidth + cellPadding[0] + cellPadding[2])
x.cell = list(cell)
#dc.SetPen(wx.BLACK_PEN)
#dc.DrawRectangle(*cell)
# Draw each cell
font = self.GetFont()
for x in combined:
cellBounds = RectUtils.InsetRect(x.cell, cellPadding)
self.DrawText(dc, x.text, cellBounds, font, x.align, x.image)
#dc.SetPen(wx.RED_PEN)
#dc.DrawRectangle(*cellBounds)
if cellFmt.GridPen and combined:
dc.SetPen(cellFmt.GridPen)
dc.SetBrush(wx.TRANSPARENT_BRUSH)
top = RectUtils.Top(combined[0].cell)
bottom = RectUtils.Bottom(combined[0].cell)
# Draw the interior dividers
for x in combined[:-1]:
right = RectUtils.Right(x.cell)
dc.DrawLine(right, top, right, bottom)
# Draw the surrounding frame
left = RectUtils.Left(combined[0].cell)
right = RectUtils.Right(combined[-1].cell)
dc.DrawRectangle(left, top, right-left, bottom-top)
#======================================================================