本文整理汇总了Python中wx.BOLD属性的典型用法代码示例。如果您正苦于以下问题:Python wx.BOLD属性的具体用法?Python wx.BOLD怎么用?Python wx.BOLD使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类wx
的用法示例。
在下文中一共展示了wx.BOLD属性的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import BOLD [as 别名]
def __init__(self, parent):
wx.Window.__init__(self, parent, -1)
self.selected = None
# all valid characters
self.chars = ""
for i in xrange(256):
if util.isValidInputChar(i):
self.chars += chr(i)
self.cols = 16
self.rows = len(self.chars) // self.cols
if len(self.chars) % 16:
self.rows += 1
# offset of grid
self.offset = 5
# size of a single character cell
self.cellSize = 32
# size of the zoomed-in character boxes
self.boxSize = 60
self.smallFont = util.createPixelFont(18,
wx.FONTFAMILY_SWISS, wx.NORMAL, wx.NORMAL)
self.normalFont = util.createPixelFont(self.cellSize - 2,
wx.FONTFAMILY_MODERN, wx.NORMAL, wx.BOLD)
self.bigFont = util.createPixelFont(self.boxSize - 2,
wx.FONTFAMILY_MODERN, wx.NORMAL, wx.BOLD)
wx.EVT_PAINT(self, self.OnPaint)
wx.EVT_LEFT_DOWN(self, self.OnLeftDown)
wx.EVT_MOTION(self, self.OnMotion)
wx.EVT_SIZE(self, self.OnSize)
util.setWH(self, self.cols * self.cellSize + 2 * self.offset, 460)
示例2: _makeFonts
# 需要导入模块: import wx [as 别名]
# 或者: from wx import BOLD [as 别名]
def _makeFonts(self):
self._sysFont = wx.SystemSettings.GetFont(wx.SYS_SYSTEM_FONT)
self._labelFont = wx.Font(self._sysFont.GetPointSize(), wx.DEFAULT, wx.NORMAL, wx.BOLD)
self._modernFont = wx.Font(self._sysFont.GetPointSize(), wx.MODERN, wx.NORMAL, wx.NORMAL)
self._smallerFont = wx.Font(self._sysFont.GetPointSize()-2, wx.DEFAULT, wx.NORMAL, wx.NORMAL)
示例3: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import BOLD [as 别名]
def __init__(self, *args, **kwds):
# begin wxGlade: MessageDialog.__init__
kwds["style"] = wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER
wx.Dialog.__init__(self, *args, **kwds)
bmp = compat.wx_ArtProvider_GetBitmap(wx.ART_TIP, wx.ART_MESSAGE_BOX, (48, 48))
self.msg_image = wx.StaticBitmap(self, wx.ID_ANY, bmp)
self.msg_list = wx.ListCtrl(self, wx.ID_ANY, style=wx.BORDER_SUNKEN | wx.LC_NO_HEADER | wx.LC_REPORT | wx.LC_SINGLE_SEL)
self.OK = wx.Button(self, wx.ID_OK, "")
# properties
self.SetTitle(_("wxGlade Message"))
self.msg_image.SetMinSize((48, 48))
self.OK.SetFocus()
self.OK.SetDefault()
# layout
sizer_1 = wx.BoxSizer(wx.VERTICAL)
sizer_2 = wx.BoxSizer(wx.HORIZONTAL)
msg_title = wx.StaticText(self, wx.ID_ANY, _("wxGlade Message"))
msg_title.SetFont(wx.Font(-1, wx.DEFAULT, wx.NORMAL, wx.BOLD, 0, ""))
sizer_1.Add(msg_title, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.ALL, 5)
sizer_2.Add(self.msg_image, 0, 0, 0)
sizer_2.Add(self.msg_list, 1, wx.EXPAND | wx.LEFT, 10)
sizer_1.Add(sizer_2, 1, wx.EXPAND | wx.LEFT | wx.RIGHT, 5)
sizer_1.Add(self.OK, 0, wx.ALIGN_RIGHT | wx.ALL, 10)
self.SetSizer(sizer_1)
self.Layout()
self.Centre()
示例4: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import BOLD [as 别名]
def __init__(self, title):
wx.Menu.__init__(self)
self.TITLE_ID = wx.NewId()
item = self.Append(self.TITLE_ID, title)
self.AppendSeparator()
font = item.GetFont()
font.SetWeight(wx.BOLD)
item.SetFont( wx.Font(font.GetPointSize(), font.GetFamily(), font.GetStyle(), wx.BOLD) )
示例5: __do_layout
# 需要导入模块: import wx [as 别名]
# 或者: from wx import BOLD [as 别名]
def __do_layout(self):
# begin wxGlade: TemplateInfoDialog.__do_layout
sizer_1 = wx.BoxSizer(wx.VERTICAL)
sizer_6 = wx.BoxSizer(wx.HORIZONTAL)
sizer_5 = wx.StaticBoxSizer(wx.StaticBox(self, wx.ID_ANY, _("Instructions")), wx.HORIZONTAL)
sizer_4 = wx.StaticBoxSizer(wx.StaticBox(self, wx.ID_ANY, _("Description")), wx.HORIZONTAL)
sizer_3 = wx.StaticBoxSizer(wx.StaticBox(self, wx.ID_ANY, _("Author")), wx.HORIZONTAL)
sizer_2 = wx.BoxSizer(wx.HORIZONTAL)
label_template_name = wx.StaticText(self, wx.ID_ANY, _("wxGlade template: "))
label_template_name.SetFont(wx.Font(-1, wx.DEFAULT, wx.NORMAL, wx.BOLD, 0, ""))
sizer_2.Add(label_template_name, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL, 10)
sizer_2.Add(self.template_name, 1, wx.ALIGN_CENTER_VERTICAL | wx.ALL, 10)
sizer_1.Add(sizer_2, 0, wx.EXPAND, 0)
sizer_3.Add(self.author, 1, 0, 0)
sizer_1.Add(sizer_3, 0, wx.ALL | wx.EXPAND, 5)
sizer_4.Add(self.description, 1, wx.EXPAND, 0)
sizer_1.Add(sizer_4, 1, wx.ALL | wx.EXPAND, 5)
sizer_5.Add(self.instructions, 1, wx.EXPAND, 0)
sizer_1.Add(sizer_5, 1, wx.ALL | wx.EXPAND, 5)
sizer_6.Add(self.button_1, 0, 0, 0)
sizer_6.Add(self.button_2, 0, wx.LEFT, 10)
sizer_1.Add(sizer_6, 0, wx.ALIGN_RIGHT | wx.ALL, 10)
self.SetSizer(sizer_1)
self.Layout()
self.Centre()
# end wxGlade
# end of class TemplateInfoDialog
示例6: __set_properties
# 需要导入模块: import wx [as 别名]
# 或者: from wx import BOLD [as 别名]
def __set_properties(self):
# begin wxGlade: TemplateListDialog.__set_properties
self.SetTitle(_("wxGlade template list"))
self.SetSize( (600, 400) )
self.template_name.SetFont(wx.Font(-1, wx.DEFAULT, wx.NORMAL, wx.BOLD, 0, ""))
# end wxGlade
示例7: process_draw
# 需要导入模块: import wx [as 别名]
# 或者: from wx import BOLD [as 别名]
def process_draw(self, gc):
if self.scene.device.draw_mode & DRAW_MODE_SELECTION != 0:
return
device = self.scene.device
draw_mode = device.draw_mode
elements = self.scene.device.device_root.elements
bounds = elements.bounds()
matrix = self.parent.matrix
if bounds is not None:
linewidth = 3.0 / matrix.value_scale_x()
self.selection_pen.SetWidth(linewidth)
font = wx.Font(14.0 / matrix.value_scale_x(), wx.SWISS, wx.NORMAL, wx.BOLD)
gc.SetFont(font, wx.BLACK)
gc.SetPen(self.selection_pen)
x0, y0, x1, y1 = bounds
center_x = (x0 + x1) / 2.0
center_y = (y0 + y1) / 2.0
gc.StrokeLine(center_x, 0, center_x, y0)
gc.StrokeLine(0, center_y, x0, center_y)
gc.StrokeLine(x0, y0, x1, y0)
gc.StrokeLine(x1, y0, x1, y1)
gc.StrokeLine(x1, y1, x0, y1)
gc.StrokeLine(x0, y1, x0, y0)
if draw_mode & DRAW_MODE_SELECTION == 0:
p = self.scene.device.device_root
conversion, name, marks, index = p.units_convert, p.units_name, p.units_marks, p.units_index
gc.DrawText("%.1f%s" % (y0 / conversion, name), center_x, y0)
gc.DrawText("%.1f%s" % (x0 / conversion, name), x0, center_y)
gc.DrawText("%.1f%s" % ((y1 - y0) / conversion, name), x1, center_y)
gc.DrawText("%.1f%s" % ((x1 - x0) / conversion, name), center_x, y1)
示例8: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import BOLD [as 别名]
def __init__(self, parent, title):
wx.Frame.__init__(self, parent, -1, title,
pos=(150, 150), size=(350, 200))
# Create the menubar
menuBar = wx.MenuBar()
# and a menu
menu = wx.Menu()
# add an item to the menu, using \tKeyName automatically
# creates an accelerator, the third param is some help text
# that will show up in the statusbar
menu.Append(wx.ID_EXIT, "E&xit\tAlt-X", "Exit this simple sample")
# bind the menu event to an event handler
self.Bind(wx.EVT_MENU, self.on_time_to_close, id=wx.ID_EXIT)
# and put the menu on the menubar
menuBar.Append(menu, "&File")
self.SetMenuBar(menuBar)
self.CreateStatusBar()
# Now create the Panel to put the other controls on.
panel = wx.Panel(self)
# and a few controls
text = wx.StaticText(panel, -1, "Hello World!")
text.SetFont(wx.Font(14, wx.SWISS, wx.NORMAL, wx.BOLD))
text.SetSize(text.GetBestSize())
btn = wx.Button(panel, -1, "Close")
funbtn = wx.Button(panel, -1, "Just for fun...")
# bind the button events to handlers
self.Bind(wx.EVT_BUTTON, self.on_time_to_close, btn)
self.Bind(wx.EVT_BUTTON, self.on_fun_button, funbtn)
# Use a sizer to layout the controls, stacked vertically and with
# a 10 pixel border around each
sizer = wx.BoxSizer(wx.VERTICAL)
sizer.Add(text, 0, wx.ALL, 10)
sizer.Add(btn, 0, wx.ALL, 10)
sizer.Add(funbtn, 0, wx.ALL, 10)
panel.SetSizer(sizer)
panel.Layout()
示例9: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import BOLD [as 别名]
def __init__(self, parent, fontsize, maximum, title, formatting_string, vertical=False):
wx.Frame.__init__(self, parent, style=wx.NO_BORDER)
if isinstance(maximum, list):
self.list_maximum = maximum
self.list_title = title
self.list_formatting_string = formatting_string
else:
self.list_maximum = [maximum]
self.list_title = [title]
self.list_formatting_string = [formatting_string]
self.labels = []
self.titles = []
self.gauges = []
self.sizer = wx.GridBagSizer(5, 5)
for i in range(len(self.list_maximum)):
if vertical:
if title:
self.titles.append(wx.StaticText(self, label=self.list_title[i] + ':', style=wx.ALIGN_LEFT))
self.labels.append(wx.StaticText(self, style=wx.ALIGN_RIGHT))
self.gauges.append(wx.Gauge(self, range=self.list_maximum[i]))
else:
if title:
self.titles.append(wx.StaticText(self, label=self.list_title[i], style=wx.ALIGN_CENTER))
self.labels.append(wx.StaticText(self, style=wx.ALIGN_CENTRE_HORIZONTAL))
self.gauges.append(wx.Gauge(self, range=self.list_maximum[i], style=wx.GA_VERTICAL))
font = wx.Font(fontsize, wx.DEFAULT, wx.NORMAL, wx.BOLD)
self.labels[i].SetFont(font)
if title:
self.titles[i].SetFont(font)
if vertical:
if title:
self.sizer.Add(self.titles[i], pos=(i, 0), flag=wx.ALL|wx.ALIGN_BOTTOM)
self.sizer.Add(self.gauges[i], pos=(i, 1), flag=wx.ALL|wx.EXPAND)
self.sizer.Add(self.labels[i], pos=(i, 2), flag=wx.ALL|wx.ALIGN_BOTTOM)
else:
if title:
self.sizer.Add(self.titles[i], pos=(0, i), flag=wx.ALL|wx.ALIGN_CENTER)
extra = wx.BoxSizer(wx.HORIZONTAL)
extra.AddStretchSpacer()
extra.Add(self.gauges[i], flag=wx.EXPAND)
extra.AddStretchSpacer()
self.sizer.Add(extra, pos=(1, i), flag=wx.ALL|wx.EXPAND)
self.sizer.Add(self.labels[i], pos=(2, i), flag=wx.ALL|wx.ALIGN_CENTER)
self.sizer.AddGrowableCol(i, 0)
if vertical:
self.sizer.AddGrowableCol(1, 1)
else:
self.sizer.AddGrowableRow(1)
self.SetSizer(self.sizer)
self.sizer.Fit(self)
示例10: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import BOLD [as 别名]
def __init__(self, *args, **kwds):
# begin wxGlade: MyFrame.__init__
kwds["style"] = kwds.get("style", 0) | wx.DEFAULT_FRAME_STYLE
wx.Frame.__init__(self, *args, **kwds)
self.SetSize((400, 300))
self.SetTitle("frame")
sizer_1 = wx.BoxSizer(wx.VERTICAL)
self.text_ctrl_1 = wx.TextCtrl(self, wx.ID_ANY, "Some Input", style=wx.TE_READONLY)
self.text_ctrl_1.SetBackgroundColour(wx.Colour(0, 255, 127))
self.text_ctrl_1.SetForegroundColour(wx.Colour(255, 0, 0))
self.text_ctrl_1.SetFont(wx.Font(16, wx.DEFAULT, wx.NORMAL, wx.BOLD, 0, ""))
self.text_ctrl_1.SetFocus()
sizer_1.Add(self.text_ctrl_1, 1, wx.ALL | wx.EXPAND, 5)
label_1 = wx.StaticText(self, wx.ID_ANY, "label_1")
sizer_1.Add(label_1, 0, 0, 0)
label_2 = wx.StaticText(self, wx.ID_ANY, "label_2")
label_2.SetFont(wx.Font(8, wx.DECORATIVE, wx.SLANT, wx.LIGHT, 0, ""))
sizer_1.Add(label_2, 0, 0, 0)
label_3 = wx.StaticText(self, wx.ID_ANY, "label_3")
label_3.SetFont(wx.Font(8, wx.ROMAN, wx.ITALIC, wx.BOLD, 0, ""))
sizer_1.Add(label_3, 0, 0, 0)
label_4 = wx.StaticText(self, wx.ID_ANY, "label_4")
label_4.SetFont(wx.Font(8, wx.SCRIPT, wx.NORMAL, wx.NORMAL, 0, ""))
sizer_1.Add(label_4, 0, 0, 0)
label_5 = wx.StaticText(self, wx.ID_ANY, "label_5")
label_5.SetFont(wx.Font(10, wx.SWISS, wx.NORMAL, wx.NORMAL, 0, ""))
sizer_1.Add(label_5, 0, 0, 0)
label_6 = wx.StaticText(self, wx.ID_ANY, "label_6")
label_6.SetFont(wx.Font(12, wx.MODERN, wx.NORMAL, wx.NORMAL, 1, ""))
sizer_1.Add(label_6, 0, 0, 0)
self.SetSizer(sizer_1)
self.Layout()
# end wxGlade
# end of class MyFrame
示例11: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import BOLD [as 别名]
def __init__(self, parent, title):
wx.Frame.__init__(self, parent, -1, title,
pos=(150, 150), size=(350, 200))
# Create the menubar
menuBar = wx.MenuBar()
# and a menu
menu = wx.Menu()
# add an item to the menu, using \tKeyName automatically
# creates an accelerator, the third param is some help text
# that will show up in the statusbar
menu.Append(wx.ID_EXIT, "E&xit\tAlt-X", "Exit this simple sample")
# bind the menu event to an event handler
self.Bind(wx.EVT_MENU, self.on_time_to_close, id=wx.ID_EXIT)
# and put the menu on the menubar
menuBar.Append(menu, "&File")
self.SetMenuBar(menuBar)
self.CreateStatusBar()
# Now create the Panel to put the other controls on.
panel = wx.Panel(self)
# and a few controls
text = wx.StaticText(panel, -1, "Hello World!")
text.SetFont(wx.Font(14, wx.SWISS, wx.NORMAL, wx.BOLD))
text.SetSize(text.GetBestSize())
btn = wx.Button(panel, -1, "Close")
funbtn = wx.Button(panel, -1, "Just for fun...")
# bind the button events to handlers
self.Bind(wx.EVT_BUTTON, self.on_time_to_close, btn)
self.Bind(wx.EVT_BUTTON, self.on_fun_button, funbtn)
# Use a sizer to layout the controls, stacked vertically and with
# a 10 pixel border around each
sizer = wx.BoxSizer(wx.VERTICAL)
sizer.Add(text, 0, wx.ALL, 10)
sizer.Add(btn, 0, wx.ALL, 10)
sizer.Add(funbtn, 0, wx.ALL, 10)
panel.SetSizer(sizer)
panel.Layout()
示例12: draw_text
# 需要导入模块: import wx [as 别名]
# 或者: from wx import BOLD [as 别名]
def draw_text(self, element, gc, draw_mode):
try:
matrix = element.transform
except AttributeError:
matrix = Matrix()
if hasattr(element, 'wxfont'):
font = element.wxfont
else:
if element.font_size < 1:
if element.font_size > 0:
element.transform.pre_scale(element.font_size,
element.font_size,
element.x,
element.y)
element.font_size = 1 # No zero sized fonts.
font = wx.Font(element.font_size, wx.SWISS, wx.NORMAL, wx.BOLD)
element.wxfont = font
gc.PushState()
gc.ConcatTransform(wx.GraphicsContext.CreateMatrix(gc, ZMatrix(matrix)))
self.set_element_pen(gc, element)
self.set_element_brush(gc, element)
if element.fill is None or element.fill == 'none':
gc.SetFont(font, wx.BLACK)
else:
gc.SetFont(font, wx.Colour(swizzlecolor(element.fill)))
text = element.text
x = element.x
y = element.y
if text is not None:
element.width, element.height = gc.GetTextExtent(element.text)
if not hasattr(element, 'anchor') or element.anchor == 'start':
y -= element.height
elif element.anchor == 'middle':
x -= (element.width / 2)
y -= element.height
elif element.anchor == 'end':
x -= element.width
y -= element.height
gc.DrawText(text, x, y)
gc.PopState()