本文整理汇总了Python中wx.ALIGN_LEFT属性的典型用法代码示例。如果您正苦于以下问题:Python wx.ALIGN_LEFT属性的具体用法?Python wx.ALIGN_LEFT怎么用?Python wx.ALIGN_LEFT使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类wx
的用法示例。
在下文中一共展示了wx.ALIGN_LEFT属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ALIGN_LEFT [as 别名]
def __init__(self, parent):
# TODO: try to use MessageBox instead, as they already include buttons, icons, etc.
wx.Dialog.__init__(self, parent, title="SCT Processing")
self.SetSize((300, 120))
vbox = wx.BoxSizer(wx.VERTICAL)
lbldesc = wx.StaticText(self, id=wx.ID_ANY, label="Processing, please wait...")
vbox.Add(lbldesc, 0, wx.ALIGN_LEFT | wx.ALL, 10)
btns = self.CreateSeparatedButtonSizer(wx.CANCEL)
vbox.Add(btns, 0, wx.ALIGN_LEFT | wx.ALL, 5)
hbox = wx.BoxSizer(wx.HORIZONTAL)
# TODO: use a nicer image, showing two gears (similar to ID_EXECUTE)
save_ico = wx.ArtProvider.GetBitmap(wx.ART_INFORMATION, wx.ART_TOOLBAR, (50, 50))
img_info = wx.StaticBitmap(self, -1, save_ico, wx.DefaultPosition, (save_ico.GetWidth(), save_ico.GetHeight()))
hbox.Add(img_info, 0, wx.ALL, 10)
hbox.Add(vbox, 0, wx.ALL, 0)
self.SetSizer(hbox)
self.Centre()
self.CenterOnParent()
# TODO: retrieve action from the cancel button
示例2: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ALIGN_LEFT [as 别名]
def __init__(self, parent, *args, **kwargs):
wx.dataview.DataViewListCtrl.__init__(self, parent, *args, **kwargs)
self._Settings = None
self.Disable()
self.AppendTextColumn('Algorithm', width=wx.COL_WIDTH_AUTOSIZE)
self.AppendColumn(
wx.dataview.DataViewColumn('Devices', DeviceListRenderer(),
1, align=wx.ALIGN_LEFT,
width=wx.COL_WIDTH_AUTOSIZE),
'string')
self.AppendTextColumn('Speed', width=wx.COL_WIDTH_AUTOSIZE)
self.AppendTextColumn('Revenue')
pub.subscribe(self._OnSettings, 'data.settings')
pub.subscribe(self._OnStartMining, 'mining.start')
pub.subscribe(self._OnStopMining, 'mining.stop')
pub.subscribe(self._OnMiningStatus, 'mining.status')
示例3: create_editor
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ALIGN_LEFT [as 别名]
def create_editor(self, panel, sizer):
label_text = self._find_label()
self.checkbox = wx.CheckBox(panel, -1, '', name=label_text)
self._display_value()
self.label_ctrl = label = self._get_label(label_text, panel, name=label_text)
if config.preferences.use_checkboxes_workaround:
size = self.checkbox.GetSize()
self.checkbox.SetLabel(label_text)
self.checkbox.SetMaxSize(size)
hsizer = wx.BoxSizer(wx.HORIZONTAL)
#hsizer.Add(label, 2, wx.ALIGN_CENTER_VERTICAL | wx.ALL, 3)
hsizer.Add(label, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL, 3)
#hsizer.SetItemMinSize(0, config.label_initial_width, -1)
#hsizer.AddSpacer(20)
hsizer.Add(self.checkbox, 0, wx.ALIGN_LEFT | wx.ALL, 3)
hsizer.AddStretchSpacer(5)
sizer.Add(hsizer, 0, wx.EXPAND)
self._set_tooltip(label, self.checkbox)
self.checkbox.Bind(wx.EVT_CHECKBOX, self.on_change_val)
self.editing = True
示例4: Timestep_Box
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ALIGN_LEFT [as 别名]
def Timestep_Box(self):
#---------------------------------------------
# Create sizer box for the process timestep
#---------------------------------------------
timestep = self.data.timestep
unit_str = "[" + timestep.units + "]"
L1 = wx.StaticText(self, -1, timestep.label + ":")
text = wx.TextCtrl(self, -1, timestep.value)
L2 = wx.StaticText(self, -1, unit_str)
#-------------------------------------------------------
box = wx.BoxSizer(wx.HORIZONTAL | wx.ALIGN_LEFT)
proportion = 0 # (do not use 1)
box.Add((self.hgap, self.hgap), proportion)
box.Add(L1)
box.Add((self.hgap, self.hgap), proportion)
box.Add(text)
box.Add((self.hgap, self.hgap), proportion)
box.Add(L2)
return box
# Timestep_Box()
#----------------------------------------------------------------
示例5: AddGrid
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ALIGN_LEFT [as 别名]
def AddGrid(self, grid, vgap=6, hgap=5):
columns = self.maxRowNum
sizer = wx.GridBagSizer(vgap, hgap)
sizer.SetFlexibleDirection(wx.HORIZONTAL)
rowFlagsGet = self.rowFlags.get
colFlagsGet = self.colFlags.get
for rowNum, (row, kwargs) in enumerate(grid):
if kwargs.get("growable", False):
sizer.AddGrowableRow(rowNum)
for colNum, ctrl in enumerate(row):
if ctrl is None:
ctrl = (1, 1)
elif type(ctrl) in types.StringTypes:
ctrl = wx.StaticText(self, -1, ctrl)
flags = rowFlagsGet(rowNum, 0) | colFlagsGet(colNum, 0)
flags |= (wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_LEFT)
sizer.Add(ctrl, (rowNum, colNum), (1, 1), flags)
if colNum < columns - 1:
sizer.SetItemSpan(ctrl, (1, columns - colNum + 1))
self.sizer.Add(sizer, 1, wx.EXPAND)
示例6: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ALIGN_LEFT [as 别名]
def __init__(self, parent, lngth):
gridlib.Grid.__init__(self, parent)
self.SetRowLabelSize(0)
self.SetColLabelSize(0)
self.SetDefaultRowSize(16)
self.SetScrollLineX(1)
self.SetScrollLineY(1)
self.EnableEditing(False)
self.EnableDragColSize(False)
self.EnableDragRowSize(False)
self.EnableDragGridSize(False)
self.EnableGridLines(False)
self.SetColMinimalAcceptableWidth(8)
self.CreateGrid(lngth, 3)
attr = gridlib.GridCellAttr()
attr.SetAlignment(wx.ALIGN_LEFT, wx.ALIGN_CENTRE)
self.SetColAttr(1,attr)
self.SetSelectionMode(gridlib.Grid.wxGridSelectRows)
self.Bind(gridlib.EVT_GRID_CMD_SELECT_CELL, self.onGridSelectCell, self)
示例7: DrawTruncatedString
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ALIGN_LEFT [as 别名]
def DrawTruncatedString(dc, text, bounds, align=wx.ALIGN_LEFT, valign=wx.ALIGN_TOP, ellipse=wx.RIGHT, ellipseChars="..."):
"""
Draw the given text truncated to the given bounds.
bounds must be a wx.Rect or a 4-element collection: (left, top, width, height).
If allowClipping is True, this method changes the clipping region so that no
text is drawn outside of the given bounds.
"""
if not text:
return
if align == wx.ALIGN_CENTER:
align = wx.ALIGN_CENTER_HORIZONTAL
if valign == wx.ALIGN_CENTER:
valign = wx.ALIGN_CENTER_VERTICAL
try:
bounds = wx.Rect(*bounds)
except:
pass
lines = WordWrapRenderer._Truncate(dc, text, bounds[2], ellipse, ellipseChars)
dc.DrawLabel(lines, bounds, align|valign)
示例8: OnPaint
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ALIGN_LEFT [as 别名]
def OnPaint(self, evt):
dc = wx.PaintDC(self)
inset = (20, 20, 20, 20)
rect = [inset[0], inset[1], self.GetSize().width-(inset[0]+inset[2]), self.GetSize().height-(inset[1]+inset[3])]
# Calculate exactly how high the wrapped is going to be and put a frame around it.
dc.SetFont(self.font)
dc.SetPen(wx.RED_PEN)
rect[3] = WordWrapRenderer.CalculateHeight(dc, self.text, rect[2])
dc.DrawRectangle(*rect)
WordWrapRenderer.DrawString(dc, self.text, rect, wx.ALIGN_LEFT)
#WordWrapRenderer.DrawTruncatedString(dc, self.text, rect, wx.ALIGN_CENTER_HORIZONTAL,s ellipse=wx.CENTER)
#bmp = wx.EmptyBitmap(rect[0]+rect[2], rect[1]+rect[3])
#mdc = wx.MemoryDC(bmp)
#mdc.SetBackground(wx.Brush("white"))
#mdc.Clear()
#mdc.SetFont(self.font)
#mdc.SetPen(wx.RED_PEN)
#rect[3] = WordWrapRenderer.CalculateHeight(mdc, self.text, rect[2])
#mdc.DrawRectangle(*rect)
#WordWrapRenderer.DrawString(mdc, self.text, rect, wx.ALIGN_LEFT)
#del mdc
#dc = wx.ScreenDC()
#dc.DrawBitmap(bmp, 20, 20)
示例9: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ALIGN_LEFT [as 别名]
def __init__(self):
"""
"""
self.padding = None
self.decorations = list()
self.font = wx.FFont(11, wx.FONTFAMILY_SWISS, face="Gill Sans")
self.textColor = None
self.textAlignment = wx.ALIGN_LEFT
self.alwaysCenter = False
self.canWrap = False
#THINK: These attributes are only for grids. Should we have a GridBlockFormat object?
self.cellPadding = None
self.gridPen = None
#----------------------------------------------------------------------------
# Accessing
示例10: _do_layout
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ALIGN_LEFT [as 别名]
def _do_layout(self):
vsizer = wx.BoxSizer(wx.VERTICAL)
sizer = wx.BoxSizer(wx.HORIZONTAL)
headings_sizer = self.build_heading_sizer()
sizer.Add(headings_sizer, 1, wx.ALIGN_LEFT | wx.ALIGN_CENTER_HORIZONTAL | wx.EXPAND | wx.LEFT, PAD_SIZE)
sizer.Add(self.settings_img, 0, wx.ALIGN_RIGHT | wx.EXPAND | wx.RIGHT, PAD_SIZE)
sizer.Add(self.running_img, 0, wx.ALIGN_RIGHT | wx.EXPAND | wx.RIGHT, PAD_SIZE)
sizer.Add(self.check_mark, 0, wx.ALIGN_RIGHT | wx.EXPAND | wx.RIGHT, PAD_SIZE)
sizer.Add(self.error_symbol, 0, wx.ALIGN_RIGHT | wx.EXPAND | wx.RIGHT, PAD_SIZE)
self.running_img.Hide()
self.check_mark.Hide()
self.error_symbol.Hide()
vsizer.Add(sizer, 1, wx.EXPAND)
self.SetSizer(vsizer)
示例11: _do_layout
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ALIGN_LEFT [as 别名]
def _do_layout(self):
self.stop_button.Hide()
self.restart_button.Hide()
v_sizer = wx.BoxSizer(wx.VERTICAL)
h_sizer = wx.BoxSizer(wx.HORIZONTAL)
h_sizer.Add(self.progress_bar, 0, wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.LEFT, 20)
self.progress_bar.Hide()
h_sizer.AddStretchSpacer(1)
h_sizer.Add(self.cancel_button, 0, wx.ALIGN_RIGHT | wx.RIGHT, 20)
h_sizer.Add(self.start_button, 0, wx.ALIGN_RIGHT | wx.RIGHT, 20)
h_sizer.Add(self.stop_button, 0, wx.ALIGN_RIGHT | wx.RIGHT, 20)
v_sizer.AddStretchSpacer(1)
v_sizer.Add(h_sizer, 0, wx.ALIGN_CENTER_VERTICAL | wx.EXPAND)
h_sizer.Add(self.edit_button, 0, wx.ALIGN_RIGHT | wx.RIGHT, 10)
h_sizer.Add(self.restart_button, 0, wx.ALIGN_RIGHT | wx.RIGHT, 10)
h_sizer.Add(self.close_button, 0, wx.ALIGN_RIGHT | wx.RIGHT, 20)
self.edit_button.Hide()
self.restart_button.Hide()
self.close_button.Hide()
v_sizer.AddStretchSpacer(1)
self.SetSizer(v_sizer)
示例12: do_layout
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ALIGN_LEFT [as 别名]
def do_layout(self, parent, titles, msgs):
self.panel = wx.Panel(parent)
self.radio_buttons = [wx.RadioButton(self.panel, -1) for _ in titles]
self.btn_names = [wx.StaticText(self.panel, label=title.title()) for title in titles]
self.help_msgs = [wx.StaticText(self.panel, label=msg.title()) for msg in msgs]
# box = wx.StaticBox(self.panel, -1, label=self.data['group_name'])
box = wx.StaticBox(self.panel, -1, label='')
vertical_container = wx.StaticBoxSizer(box, wx.VERTICAL)
for button, name, help in zip(self.radio_buttons, self.btn_names, self.help_msgs):
hbox = wx.BoxSizer(wx.HORIZONTAL)
hbox.Add(button, 0, wx.ALIGN_TOP | wx.ALIGN_LEFT)
hbox.Add(name, 0, wx.LEFT, 10)
vertical_container.Add(hbox, 0, wx.EXPAND)
vertical_container.Add(help, 1, wx.EXPAND | wx.LEFT, 25)
vertical_container.AddSpacer(5)
self.panel.SetSizer(vertical_container)
self.panel.Bind(wx.EVT_SIZE, self.onResize)
self.panel.Bind(wx.EVT_RADIOBUTTON, self.showz)
return self.panel
示例13: doLayout
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ALIGN_LEFT [as 别名]
def doLayout(self):
mainSizer = wx.BoxSizer(wx.HORIZONTAL)
gridSizer = wx.FlexGridSizer(3, 2, 5,10)
gridSizer.AddMany([(self.timeLabel),
(0, 0),
(self.statisticsLabel),
(self.valuesLabel),
(self.statisticsTextCtrl, 1, wx.EXPAND),
(self.valuesTextCtrl, 1, wx.EXPAND)])
gridSizer.AddGrowableRow(2, 1)
gridSizer.AddGrowableCol(1, 1)
gridSizer.AddGrowableCol(0, 1)
mainSizer.Add(gridSizer, proportion = 2,
flag = wx.ALIGN_LEFT | wx.ALL |wx.EXPAND, border=5)
self.SetSizer(mainSizer)
示例14: doLayout
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ALIGN_LEFT [as 别名]
def doLayout(self):
mainSizer = wx.BoxSizer(wx.VERTICAL)
mainSizer.Add(self.logger, 0, wx.ALIGN_LEFT | wx.ALL, 3)
mainSizer.Add(self.saveLoggerButton, 0, wx.ALIGN_LEFT | wx.ALL, 3)
self.SetSizerAndFit(mainSizer)
示例15: _init_ui
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ALIGN_LEFT [as 别名]
def _init_ui(self):
"""Initialize UI components."""
# Add layout management
self.hbox = wx.BoxSizer(wx.HORIZONTAL)
self.fgs = wx.FlexGridSizer(rows=self.n_items, cols=2, vgap=0, hgap=2)
# Create items to add
for _i, (key, value) in enumerate(zip(self.labels, self.colors)):
self.label = wx.StaticText(self,
label=str(key),
style=wx.ALIGN_LEFT,
)
self.colorbox = csel.ColourSelect(self,
_i,
"",
tuple(value),
style=wx.NO_BORDER,
size=(20, 20))
self.Bind(csel.EVT_COLOURSELECT, self.on_color_pick, id=_i)
self.fgs.Add(self.label, flag=wx.ALIGN_CENTER_VERTICAL)
self.fgs.Add(self.colorbox)
# Add our items to the layout manager and set the sizer.
self.hbox.Add(self.fgs)
self.SetSizer(self.hbox)