Python wx.DEFAULT Examples
The following are 18
code examples of wx.DEFAULT().
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: easyshell.py From Zulu with GNU Affero General Public License v3.0 | 6 votes |
def __set_properties(self): # begin wxGlade: FrameTerminal.__set_properties #self.SetTitle("serialAssist") _icon = wx.EmptyIcon() path = self.outputwin.workingdir _icon.CopyFromBitmap(wx.Bitmap(path + "/../images/zulu_logo16x16.png", wx.BITMAP_TYPE_ANY)) self.SetIcon(_icon) #self.SetSize((543, 433)) self.SetSize((743, 560)) self.frame_statusbar.SetStatusWidths([-1]) # statusbar fields frame_statusbar_fields = [""] for i in range(len(frame_statusbar_fields)): self.frame_statusbar.SetStatusText(frame_statusbar_fields[i], i) self.frame_toolbar.SetToolBitmapSize((32, 32)) self.frame_toolbar.SetToolSeparation(9) self.frame_toolbar.Realize() self.text_ctrl_output.SetFont(wx.Font(11, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "")) # end wxGlade
Example #2
Source File: CustomGrid.py From OpenPLC_Editor with GNU General Public License v3.0 | 6 votes |
def __init__(self, *args, **kwargs): wx.grid.Grid.__init__(self, *args, **kwargs) self.Editable = True self.AddButton = None self.DeleteButton = None self.UpButton = None self.DownButton = None self.SetFont(wx.Font(12, wx.DEFAULT, wx.NORMAL, wx.NORMAL, False, 'Sans')) self.SetLabelFont(wx.Font(10, wx.DEFAULT, wx.NORMAL, wx.NORMAL, False, 'Sans')) self.SetSelectionBackground(wx.WHITE) self.SetSelectionForeground(wx.BLACK) self.DisableDragRowSize() self.Bind(wx.grid.EVT_GRID_SELECT_CELL, self.OnSelectCell) self.Bind(wx.grid.EVT_GRID_EDITOR_HIDDEN, self.OnEditorHidden) self.Bind(wx.EVT_KEY_DOWN, self.OnKeyDown)
Example #3
Source File: bug163.py From wxGlade with MIT License | 6 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.SetTitle(_("MyFrame")) sizer_1 = wx.BoxSizer(wx.VERTICAL) self.label_1 = wx.StaticText(self, wx.ID_ANY, _("Extraproperty example")) self.label_1.SetFont(wx.Font(40, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "")) self.label_1.SetFoobar(1) sizer_1.Add(self.label_1, 1, wx.ALL, 5) self.SetSizer(sizer_1) sizer_1.Fit(self) self.Layout() # end wxGlade # end of class MyFrame
Example #4
Source File: elecsus_gui.py From ElecSus with Apache License 2.0 | 5 votes |
def __init__(self, parent, mainwin, ID): """ mainwin is the main panel so we can bind buttons to actions in the main frame """ scrolled.ScrolledPanel.__init__(self, parent) statusTitle = wx.StaticText(self, wx.ID_ANY, ID) font = wx.Font(12,wx.DEFAULT, wx.NORMAL,wx.NORMAL) statusTitle.SetFont(font) self.StatusTextBox = wx.TextCtrl(self,wx.ID_ANY,"",style=wx.TE_READONLY|wx.TE_MULTILINE) #self.StatusTextBox.Size.SetHeight(500) self.SaveBtn = wx.Button(self,wx.ID_ANY,"Save Text to file",size=(100,-1)) self.Bind(wx.EVT_BUTTON,self.OnSave,self.SaveBtn) panel_sizer = wx.BoxSizer(wx.VERTICAL) panel_sizer.Add((-1,10),0,wx.EXPAND) panel_sizer.Add(statusTitle,0,wx.EXPAND|wx.LEFT,border=20) panel_sizer.Add((-1,10),0,wx.EXPAND) panel_sizer.Add(self.StatusTextBox,1,wx.EXPAND|wx.LEFT|wx.RIGHT,border=40) panel_sizer.Add((-1,10),0,wx.EXPAND) panel_sizer.Add(self.SaveBtn,0,wx.EXPAND|wx.LEFT|wx.RIGHT,border=40) panel_sizer.Add((-1,20),0,wx.EXPAND) self.SetSizer(panel_sizer) self.SetupScrolling() self.Layout()
Example #5
Source File: easyshell.py From Zulu with GNU Affero General Public License v3.0 | 5 votes |
def __parse_initial(self): path = self.outputwin.workingdir try: f = open(path + '/serial_init.txt', 'r') parseInitFile(f, self.serial, self.settings) f.close() #if load init file fails, we reload the defaults except Exception, e: print e self.serial.port = S_PORT self.serial.baudrate = S_BAUDRATE self.serial.bytesize = S_BYTESIZE self.serial.stopbits = S_STOPBITS self.serial.parity = S_PARITY self.serial.rtscts = S_RTSCTS self.serial.xonxoff = S_XONXOFF self.settings.echo = D_ECHO self.settings.newline = D_NEWLINE self.settings.unprintable = D_UNPRINTABLE self.settings.forecolor = D_FOREGROUND_COLOR self.settings.backcolor = D_BACKGROUND_COLOR self.settings.font = wx.Font(13, wx.DEFAULT, wx.NORMAL, wx.NORMAL, False, u'Courier 10 Pitch') self.outputwin.ser = self.serial
Example #6
Source File: easyshell.py From Zulu with GNU Affero General Public License v3.0 | 5 votes |
def parseInitFile(f, serial, settings): d = [line[:-1].strip() for line in f.readlines()] #parse not comment starts with # and [serial] information a = [line for line in d if line != '' and line[0] != '[' and line[0] != '#'] ee = [c.split('#',1)[0].strip().split('=') for c in a] qq = [(a[0].strip(),a[1].strip()) for a in ee] for name, value in qq: #parity='N' or'O' can not be eval() if name == 'parity': serial.parity = value #sometimes port = '/dev/ttyS0' elif name == 'port': try: serial.port = int(value) except: serial.port = value #font format as "fontname-pointsize" as "Courier 10 Pitch-10" elif name == 'font': x,y = value.split('-') #utf-8 is always our choice :D try: settings.font = wx.Font(eval(y), wx.DEFAULT, wx.NORMAL, wx.NORMAL, False, x) except UnicodeDecodeError: settings.font = wx.Font(eval(y), wx.DEFAULT, wx.NORMAL, wx.NORMAL, False, x.decode('utf-8')) #for other attrs, we just set there attr by setattr and got their value by eval() else: if hasattr(serial, name): setattr(serial,name, eval(value)) else: setattr(settings,name, eval(value))
Example #7
Source File: ConfTreeNodeEditor.py From OpenPLC_Editor with GNU General Public License v3.0 | 5 votes |
def GenerateMethodButtonSizer(self): normal_bt_font = wx.Font(faces["size"] // 3, wx.DEFAULT, wx.NORMAL, wx.NORMAL, faceName=faces["helv"]) mouseover_bt_font = wx.Font(faces["size"] // 3, wx.DEFAULT, wx.NORMAL, wx.NORMAL, faceName=faces["helv"], underline=True) msizer = wx.BoxSizer(wx.HORIZONTAL) for confnode_method in self.Controler.ConfNodeMethods: if "method" in confnode_method and confnode_method.get("shown", True): button = GenBitmapTextButton(self.Editor, bitmap=GetBitmap(confnode_method.get("bitmap", "Unknown")), label=confnode_method["name"], style=wx.NO_BORDER) button.SetFont(normal_bt_font) button.SetToolTipString(confnode_method["tooltip"]) if confnode_method.get("push", False): button.Bind(wx.EVT_LEFT_DOWN, self.GetButtonCallBackFunction(confnode_method["method"], True)) else: button.Bind(wx.EVT_BUTTON, self.GetButtonCallBackFunction(confnode_method["method"]), button) # a fancy underline on mouseover def setFontStyle(b, s): def fn(event): b.SetFont(s) b.Refresh() event.Skip() return fn button.Bind(wx.EVT_ENTER_WINDOW, setFontStyle(button, mouseover_bt_font)) button.Bind(wx.EVT_LEAVE_WINDOW, setFontStyle(button, normal_bt_font)) # hack to force size to mini if not confnode_method.get("enabled", True): button.Disable() msizer.AddWindow(button, flag=wx.ALIGN_CENTER) return msizer
Example #8
Source File: OptionsDialog.py From EventGhost with GNU General Public License v2.0 | 5 votes |
def UpdateFont(self, val): font = eg.document.frame.treeCtrl.GetFont() if val: font = wx.Font(font.GetPointSize(), wx.DEFAULT, wx.NORMAL, wx.NORMAL, False, "Courier New") wx.CallAfter(eg.document.frame.logCtrl.SetFont, font)
Example #9
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 #10
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 #11
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 #12
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 #13
Source File: console.py From Gooey with MIT License | 5 votes |
def getFontStyle(self): """ Force wx.Modern style to support legacy monospace_display param when present """ return (wx.MODERN if self.buildSpec['monospace_display'] else wx.DEFAULT)
Example #14
Source File: base_window.py From me-ica with GNU Lesser General Public License v2.1 | 5 votes |
def set_display_font_style(self, style): # TODO: make this not stupid # TODO: _actual_ font support self.runtime_display.set_font_style( wx.MODERN if style == 'monospace' else wx.DEFAULT)
Example #15
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 #16
Source File: params.py From admin4 with Apache License 2.0 | 4 votes |
def OnButtonSelect(self, evt): if self.textModified: # text has newer value try: self.value = eval(self.text.GetValue()) except SyntaxError: wx.LogError('Syntax error in parameter value: ' + self.GetName()) self.value = self._defaultValue() # Make initial font # Default values size = g._sysFont.GetPointSize() family = wx.DEFAULT style = weight = wx.NORMAL underlined = 0 face = '' enc = wx.FONTENCODING_DEFAULT # Fall back to default if exceptions error = False try: try: size = int(self.value[0]) except ValueError: error = True; wx.LogError('Invalid size specification') try: family = fontFamiliesXml2wx[self.value[1]] except KeyError: error = True; wx.LogError('Invalid family specification') try: style = fontStylesXml2wx[self.value[2]] except KeyError: error = True; wx.LogError('Invalid style specification') try: weight = fontWeightsXml2wx[self.value[3]] except KeyError: error = True; wx.LogError('Invalid weight specification') try: underlined = bool(self.value[4]) except ValueError: error = True; wx.LogError('Invalid underlined flag specification') face = self.value[5] except IndexError: error = True mapper = wx.FontMapper() if not self.value[6]: enc = mapper.CharsetToEncoding(self.value[6]) if error: wx.LogError('Invalid font specification') if enc == wx.FONTENCODING_DEFAULT: enc = wx.FONTENCODING_SYSTEM font = wx.Font(size, family, style, weight, underlined, face, enc) data = wx.FontData() data.SetInitialFont(font) dlg = wx.FontDialog(self, data) if dlg.ShowModal() == wx.ID_OK: font = dlg.GetFontData().GetChosenFont() if font.GetEncoding() == wx.FONTENCODING_SYSTEM: encName = '' else: encName = wx.FontMapper.GetEncodingName(font.GetEncoding()).encode() value = [str(font.GetPointSize()), fontFamiliesWx2Xml.get(font.GetFamily(), "default"), fontStylesWx2Xml.get(font.GetStyle(), "normal"), fontWeightsWx2Xml.get(font.GetWeight(), "normal"), str(int(font.GetUnderlined())), font.GetFaceName().encode(), encName ] self.SetValue(value) self.SetModified() self.textModified = False dlg.Destroy() ################################################################################
Example #17
Source File: IDEFrame.py From OpenPLC_Editor with GNU General Public License v3.0 | 4 votes |
def OnPrintPage(self, page): dc = self.GetDC() dc.SetBackground(wx.WHITE_BRUSH) dc.Clear() dc.SetUserScale(1.0, 1.0) dc.SetDeviceOrigin(0, 0) dc.printing = not self.Preview # Get the size of the DC in pixels ppiPrinterX, ppiPrinterY = self.GetPPIPrinter() pw, ph = self.GetPageSizePixels() dw, dh = dc.GetSizeTuple() Xscale = (dw * ppiPrinterX) / (pw * 25.4) Yscale = (dh * ppiPrinterY) / (ph * 25.4) fontsize = self.FontSize * Yscale margin_left = self.Margins[0].x * Xscale margin_top = self.Margins[0].y * Yscale area_width = dw - self.Margins[1].x * Xscale - margin_left area_height = dh - self.Margins[1].y * Yscale - margin_top dc.SetPen(MiterPen(wx.BLACK)) dc.SetBrush(wx.TRANSPARENT_BRUSH) dc.DrawRectangle(margin_left, margin_top, area_width, area_height) dc.SetFont(wx.Font(fontsize, wx.DEFAULT, wx.NORMAL, wx.NORMAL)) dc.SetTextForeground(wx.BLACK) block_name = " - ".join(self.Viewer.GetTagName().split("::")[1:]) _text_width, text_height = dc.GetTextExtent(block_name) dc.DrawText(block_name, margin_left, margin_top - text_height - self.TextMargin) dc.DrawText(_("Page: %d") % page, margin_left, margin_top + area_height + self.TextMargin) # Calculate the position on the DC for centering the graphic posX = area_width * ((page - 1) % self.PageGrid[0]) posY = area_height * ((page - 1) // self.PageGrid[0]) scaleX = area_width / self.PageSize[0] scaleY = area_height / self.PageSize[1] scale = min(scaleX, scaleY) # Set the scale and origin dc.SetDeviceOrigin(-posX + margin_left, -posY + margin_top) dc.SetClippingRegion(posX, posY, self.PageSize[0] * scale, self.PageSize[1] * scale) dc.SetUserScale(scale, scale) self.Viewer.DoDrawing(dc, True) return True
Example #18
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)