本文整理汇总了Python中wx.SWISS属性的典型用法代码示例。如果您正苦于以下问题:Python wx.SWISS属性的具体用法?Python wx.SWISS怎么用?Python wx.SWISS使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类wx
的用法示例。
在下文中一共展示了wx.SWISS属性的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import SWISS [as 别名]
def __init__(self, parent, tip, restricted=True):
"""
Constructor
@param parent: Parent window
@param tip: Tip text (may be multiline)
@param restricted: Tool tip must follow size restriction in line and
characters number defined (default True)
"""
wx.PopupWindow.__init__(self, parent)
self.Restricted = restricted
self.SetBackgroundStyle(wx.BG_STYLE_CUSTOM)
self.SetTip(tip)
# Initialize text font style
self.Font = wx.Font(
faces["size"],
wx.SWISS,
wx.NORMAL,
wx.NORMAL,
faceName=faces["mono"])
self.Bind(wx.EVT_PAINT, self.OnPaint)
示例2: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import SWISS [as 别名]
def __init__(self, parent, sync_model):
wx.Panel.__init__(self, parent, style=wx.RAISED_BORDER)
headerFont = wx.Font(11.5, wx.SWISS, wx.NORMAL, wx.NORMAL)
self.sync_model = sync_model
self.dstc = GoSyncDriveTree(self, pos=(0,0))
self.t1 = wx.StaticText(self, -1, "Choose the directories to sync:", pos=(0,0))
self.t1.SetFont(headerFont)
self.cb = wx.CheckBox(self, -1, 'Sync Everything', (10, 10))
self.cb.SetValue(True)
self.cb.Disable()
self.dstc.Disable()
self.cb.Bind(wx.EVT_CHECKBOX, self.SyncSetting)
self.Bind(CT.EVT_TREE_ITEM_CHECKED, self.ItemChecked)
GoSyncEventController().BindEvent(self, GOSYNC_EVENT_CALCULATE_USAGE_DONE,
self.RefreshTree)
GoSyncEventController().BindEvent(self, GOSYNC_EVENT_CALCULATE_USAGE_STARTED,
self.OnUsageCalculationStarted)
self.cb.Bind(wx.EVT_CHECKBOX, self.SyncSetting)
sizer = wx.BoxSizer(wx.VERTICAL)
sizer.Add(self.t1, 0, wx.ALL)
sizer.Add(self.cb, 0, wx.ALL)
sizer.Add(self.dstc, 1, wx.EXPAND,2)
self.SetSizer(sizer)
示例3: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import SWISS [as 别名]
def __init__(self, *args, **kw):
super(Link, self).__init__(*args, **kw)
self.font1 = wx.Font(11, wx.SWISS, wx.NORMAL, wx.NORMAL, True, u'微软雅黑')
self.font2 = wx.Font(11, wx.SWISS, wx.NORMAL, wx.NORMAL, False, u'微软雅黑')
self.SetFont(self.font2)
self.SetForegroundColour('#0000ff')
self.Bind(wx.EVT_MOUSE_EVENTS, self.OnMouseEvent)
self.Bind(wx.EVT_MOTION, self.OnMouseEvent)
示例4: process_draw
# 需要导入模块: import wx [as 别名]
# 或者: from wx import SWISS [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)
示例5: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import SWISS [as 别名]
def __init__(self, parent):
wx.Panel.__init__(self, parent, -1, style=wx.FULL_REPAINT_ON_RESIZE)
self.Bind(wx.EVT_PAINT, self.OnPaint)
self.text = """This is Thisisareallylongwordtoseewhathappens the text to be drawn. It needs to be long to see if wrapping works. to long words.
This is on new line by itself.
This should have a blank line in front of it but still wrap when we reach the edge.
The bottom of the red rectangle should be immediately below this."""
self.font = wx.Font(12, wx.SWISS, wx.NORMAL, wx.NORMAL, faceName="Gill Sans")
示例6: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import SWISS [as 别名]
def __init__(self, text, font=None, color=None, angle=30, over=True):
"""
"""
self.text = text
self.color = color or wx.Color(128, 128, 128, 128)
self.font = font or wx.FFont(128, wx.SWISS, 0)
self.angle = angle
self.over = over
示例7: createControls
# 需要导入模块: import wx [as 别名]
# 或者: from wx import SWISS [as 别名]
def createControls(self):
self.lineLabel1 = wx.StaticText(self, label=" ")
self.lineLabel2 = wx.StaticText(self, label=" ")
self.lineLabel3 = wx.StaticText(self, label=" ")
self.lineLabel4 = wx.StaticText(self, label=" ")
self.pathLabel = wx.StaticText(self, label="Path/Source:")
self.pathTextCtrl = wx.TextCtrl(self, value="")
self.fileLabel = wx.StaticText(self, label="File/Table:")
self.fileTextCtrl = wx.TextCtrl(self, value="*")
self.startdateLabel = wx.StaticText(self, label="Start date:")
self.startDatePicker = wxDatePickerCtrl(self, style=wxDP_DEFAULT)
# the following line produces error in my win xp installation
self.startTimePicker = wx.TextCtrl(self, value="00:00:00")
self.enddateLabel = wx.StaticText(self, label="End date:")
self.endDatePicker = wxDatePickerCtrl(self, style=wxDP_DEFAULT)
self.endTimePicker = wx.TextCtrl(self, value=datetime.now().strftime('%X'))
self.trimStreamButton = wx.Button(self,-1,"Trim timerange",size=(160,30))
self.plotOptionsLabel = wx.StaticText(self, label="Plotting options:")
#self.flagOptionsLabel = wx.StaticText(self, label="Flagging methods:")
self.selectKeysButton = wx.Button(self,-1,"Select Columns",size=(160,30))
self.dropKeysButton = wx.Button(self,-1,"Drop Columns",size=(160,30))
self.extractValuesButton = wx.Button(self,-1,"Extract Values",size=(160,30))
self.restoreButton = wx.Button(self,-1,"Restore data",size=(160,30))
self.changePlotButton = wx.Button(self,-1,"Plot Options",size=(160,30))
self.dailyMeansButton = wx.Button(self,-1,"Daily Means",size=(160,30))
self.applyBCButton = wx.Button(self,-1,"Baseline Corr",size=(160,30))
self.getGapsButton = wx.Button(self,-1,"Get gaps",size=(160,30))
#self.flagOutlierButton = wx.Button(self,-1,"Flag Outlier",size=(160,30))
#self.flagRangeButton = wx.Button(self,-1,"Flag Range",size=(160,30))
#self.flagMinButton = wx.Button(self,-1,"Flag Minimum",size=(160,30))
#self.flagMaxButton = wx.Button(self,-1,"Flag Maximum",size=(160,30))
#self.xCheckBox = wx.CheckBox(self,label="X ")
#self.yCheckBox = wx.CheckBox(self,label="Y ")
#self.zCheckBox = wx.CheckBox(self,label="Z ")
#self.fCheckBox = wx.CheckBox(self,label="F ")
#self.FlagIDText = wx.StaticText(self,label="Select Min/Max Flag ID:")
#self.FlagIDComboBox = wx.ComboBox(self, choices=self.flagidlist,
# style=wx.CB_DROPDOWN, value=self.flagidlist[3],size=(160,-1))
#self.flagSelectionButton = wx.Button(self,-1,"Flag Selection",size=(160,30))
#self.flagDropButton = wx.Button(self,-1,"Drop flagged",size=(160,30))
#self.flagLoadButton = wx.Button(self,-1,"Load flags",size=(160,30))
#self.flagSaveButton = wx.Button(self,-1,"Save flags",size=(160,30))
#self.flagClearButton = wx.Button(self,-1,"Clear flags",size=(160,30))
self.compRadioBox = wx.RadioBox(self,
label="Select components",
choices=self.comp, majorDimension=3, style=wx.RA_SPECIFY_COLS)
self.symbolRadioBox = wx.RadioBox(self,
label="Select symbols",
choices=self.symbol, majorDimension=2, style=wx.RA_SPECIFY_COLS)
self.annotateCheckBox = wx.CheckBox(self,label="annotate")
self.errorBarsCheckBox = wx.CheckBox(self,label="error bars")
self.confinexCheckBox = wx.CheckBox(self,
label="confine time")
self.compRadioBox.Disable()
self.symbolRadioBox.Disable()
#self.dailyMeansButton.SetFont(wx.Font(14, wx.SWISS, wx.NORMAL, wx.NORMAL))
示例8: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import SWISS [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 SWISS [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
示例10: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import SWISS [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()
示例11: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import SWISS [as 别名]
def __init__(self, parent, name="", text="", icon=None, url = None):
text = REPLACE_BR_TAG.sub('\n', text)
text = REMOVE_HTML_PATTERN.sub('', text).strip()
if text == name:
text = ""
self.parent = parent
wx.PyWindow.__init__(self, parent, -1)
self.SetBackgroundColour(
wx.SystemSettings.GetColour(wx.SYS_COLOUR_WINDOW)
)
nameBox = wx.StaticText(self, -1, name)
font = wx.Font(8, wx.SWISS, wx.NORMAL, wx.FONTWEIGHT_BOLD)
nameBox.SetFont(font)
self.text = '<html><body bgcolor="%s" text="%s">%s</body></html>' % (
self.GetBackgroundColour().GetAsString(wx.C2S_HTML_SYNTAX),
self.GetForegroundColour().GetAsString(wx.C2S_HTML_SYNTAX),
text
)
if url:
self.text = eg.Utils.AppUrl(self.text, url)
descBox = eg.HtmlWindow(self, style=wx.html.HW_NO_SELECTION)
descBox.SetBorders(1)
descBox.SetFonts("Arial", "Times New Roman", [8, 8, 8, 8, 8, 8, 8])
descBox.Bind(wx.html.EVT_HTML_LINK_CLICKED, self.OnLinkClicked)
self.descBox = descBox
staticBitmap = wx.StaticBitmap(self)
staticBitmap.SetIcon(icon.GetWxIcon())
mainSizer = eg.HBoxSizer(
((4, 4)),
(staticBitmap, 0, wx.TOP, 5),
((4, 4)),
(eg.VBoxSizer(
((4, 4)),
(eg.HBoxSizer(
(nameBox, 1, wx.EXPAND | wx.ALIGN_BOTTOM),
), 0, wx.EXPAND | wx.TOP, 2),
(descBox, 1, wx.EXPAND | wx.LEFT | wx.RIGHT, 8),
), 1, wx.EXPAND),
)
# odd sequence to setup the window, but all other ways seem
# to wrap the text wrong
self.SetSizer(mainSizer)
self.SetAutoLayout(True)
mainSizer.Fit(self)
mainSizer.Layout()
self.Layout()
self.Bind(wx.EVT_SIZE, self.OnSize)
示例12: draw_text
# 需要导入模块: import wx [as 别名]
# 或者: from wx import SWISS [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()