Python wx.BOLD Examples
The following are 13
code examples of wx.BOLD().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
wx
, or try the search function
.
Example #1
Source File: charmapdlg.py From trelby with GNU General Public License v2.0 | 5 votes |
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)
Example #2
Source File: globals.py From admin4 with Apache License 2.0 | 5 votes |
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)
Example #3
Source File: msgdialog.py From wxGlade with MIT License | 5 votes |
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()
Example #4
Source File: misc.py From wxGlade with MIT License | 5 votes |
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) )
Example #5
Source File: templates_ui.py From wxGlade with MIT License | 5 votes |
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
Example #6
Source File: templates_ui.py From wxGlade with MIT License | 5 votes |
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
Example #7
Source File: Widget.py From meerk40t with MIT License | 5 votes |
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)
Example #8
Source File: gui-wx.py From PyDev.Debugger with Eclipse Public License 1.0 | 4 votes |
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()
Example #9
Source File: activities_dashboard.py From grass-tangible-landscape with GNU General Public License v2.0 | 4 votes |
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)
Example #10
Source File: FontTest28.py From wxGlade with MIT License | 4 votes |
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
Example #11
Source File: gui-wx.py From filmkodi with Apache License 2.0 | 4 votes |
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()
Example #12
Source File: LaserRender.py From meerk40t with MIT License | 4 votes |
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()
Example #13
Source File: Widget.py From meerk40t with MIT License | 4 votes |
def process_draw(self, gc): if self.scene.device.draw_mode & DRAW_MODE_GUIDES != 0: return gc.SetPen(wx.BLACK_PEN) w, h = gc.Size p = self.scene.device.device_root scaled_conversion = p.units_convert * self.scene.widget_root.scene_widget.matrix.value_scale_x() if scaled_conversion == 0: return wpoints = w / 15.0 hpoints = h / 15.0 points = min(wpoints, hpoints) # tweak the scaled points into being useful. # points = scaled_conversion * round(points / scaled_conversion * 10.0) / 10.0 points = scaled_conversion * float('{:.1g}'.format(points / scaled_conversion)) sx, sy = self.scene.convert_scene_to_window([0, 0]) if points == 0: return offset_x = sx % points offset_y = sy % points starts = [] ends = [] x = offset_x length = 50 font = wx.Font(10, wx.SWISS, wx.NORMAL, wx.BOLD) gc.SetFont(font, wx.BLACK) while x < w: starts.append((x, 0)) ends.append((x, length)) starts.append((x, h)) ends.append((x, h-length)) mark_point = (x - sx) / scaled_conversion if round(mark_point * 1000) == 0: mark_point = 0.0 # prevents -0 gc.DrawText("%g %s" % (mark_point, p.units_name), x, 0, -tau / 4) x += points y = offset_y while y < h: starts.append((0, y)) ends.append((length, y)) starts.append((w, y)) ends.append((w-length, y)) mark_point = (y - sy) / scaled_conversion if round(mark_point * 1000) == 0: mark_point = 0.0 # prevents -0 gc.DrawText("%g %s" % (mark_point + 0, p.units_name), 0, y + 0) y += points gc.StrokeLineSegments(starts, ends)