本文整理汇总了Python中wx.ALIGN_CENTRE属性的典型用法代码示例。如果您正苦于以下问题:Python wx.ALIGN_CENTRE属性的具体用法?Python wx.ALIGN_CENTRE怎么用?Python wx.ALIGN_CENTRE使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类wx
的用法示例。
在下文中一共展示了wx.ALIGN_CENTRE属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ALIGN_CENTRE [as 别名]
def __init__(self, parent, gui_size):
h = gui_size[0]
w = gui_size[1]
wx.Panel.__init__(self, parent, -1, style=wx.SUNKEN_BORDER, size=(h, w))
## design the panel
sizer = wx.GridBagSizer(10, 7)
# Add image of DLC
icon = wx.StaticBitmap(self, bitmap=wx.Bitmap(dlc))
sizer.Add(icon, pos=(0, 0), span=(0, 8), flag=wx.EXPAND | wx.BOTTOM, border=10)
line = wx.StaticLine(self)
sizer.Add(line, pos=(1, 0), span=(1, 8), flag=wx.EXPAND | wx.BOTTOM, border=10)
# if editing this text make sure you add the '\n' to get the new line. The sizer is unable to format lines correctly.
description = "DeepLabCut™ is an open source tool for markerless\npose estimation of user-defined body parts with deep learning.\nA. and M.W. Mathis Labs | http://www.deeplabcut.org\n \nWelcome to the DeepLabCut Project Manager GUI!\nTo get started, please click on the 'Manage Project'\n tab to create or load an existing project. \n "
self.proj_name = wx.StaticText(self, label=description, style=wx.ALIGN_CENTRE)
sizer.Add(self.proj_name, pos=(2, 3), border=10)
sizer.AddGrowableCol(2)
self.SetSizer(sizer)
sizer.Fit(self)
示例2: Configure
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ALIGN_CENTRE [as 别名]
def Configure(self, *args):
"""
This should be overridden in a subclass, if the plugin wants to have
a configuration dialog.
When the plugin is freshly added by the user to the configuration tree
there are no *\*args* and you must therefore supply sufficient
default arguments.
If the plugin is reconfigured by the user, this method will be called
with the same arguments as the :meth:`!__start__` method would receive.
"""
panel = eg.ConfigPanel()
panel.dialog.buttonRow.applyButton.Enable(False)
label = panel.StaticText(
eg.text.General.noOptionsAction,
style=wx.ALIGN_CENTRE | wx.ST_NO_AUTORESIZE
)
panel.sizer.Add((0, 0), 1, wx.EXPAND)
panel.sizer.Add(label, 0, wx.ALIGN_CENTRE)
panel.sizer.Add((0, 0), 1, wx.EXPAND)
while panel.Affirmed():
panel.SetResult()
示例3: Configure
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ALIGN_CENTRE [as 别名]
def Configure(self, *args):
"""
This should be overridden in a subclass, if the plugin wants to have
a configuration dialog.
When the plugin is freshly added by the user to the configuration tree
there are no *\*args* and you must therefore supply sufficient
default arguments.
If the plugin is reconfigured by the user, this method will be called
with the same arguments as the :meth:`!__start__` method would receive.
"""
panel = eg.ConfigPanel()
panel.dialog.buttonRow.applyButton.Enable(False)
label = panel.StaticText(
eg.text.General.noOptionsPlugin,
style=wx.ALIGN_CENTRE | wx.ST_NO_AUTORESIZE
)
panel.sizer.Add((0, 0), 1, wx.EXPAND)
panel.sizer.Add(label, 0, wx.ALIGN_CENTRE)
panel.sizer.Add((0, 0), 1, wx.EXPAND)
while panel.Affirmed():
panel.SetResult()
示例4: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ALIGN_CENTRE [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)
示例5: CreateSyncManagerTable
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ALIGN_CENTRE [as 别名]
def CreateSyncManagerTable(self):
"""
Create grid for "SyncManager"
"""
# declare Table object
self.SyncManagersTable = SyncManagersTable(self, [], GetSyncManagersTableColnames())
self.SyncManagersGrid.SetTable(self.SyncManagersTable)
# set grid alignment attr. (CENTER)
self.SyncManagersGridColAlignements = [wx.ALIGN_CENTRE, wx.ALIGN_CENTRE, wx.ALIGN_CENTRE,
wx.ALIGN_CENTRE, wx.ALIGN_CENTRE, wx.ALIGN_CENTRE]
# set grid size
self.SyncManagersGridColSizes = [40, 150, 100, 100, 100, 100]
self.SyncManagersGrid.SetRowLabelSize(0)
for col in range(self.SyncManagersTable.GetNumberCols()):
attr = wx.grid.GridCellAttr()
attr.SetAlignment(self.SyncManagersGridColAlignements[col], wx.ALIGN_CENTRE)
self.SyncManagersGrid.SetColAttr(col, attr)
self.SyncManagersGrid.SetColMinimalWidth(col, self.SyncManagersGridColSizes[col])
self.SyncManagersGrid.AutoSizeColumn(col, False)
self.RefreshSlaveInfos()
示例6: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ALIGN_CENTRE [as 别名]
def __init__( self, parent ):
wx.Frame.__init__ ( self, parent, id = wx.ID_ANY, title = u"POS and Accounting", pos = wx.DefaultPosition, size = wx.Size( 676,460 ), style = wx.DEFAULT_FRAME_STYLE|wx.MAXIMIZE|wx.TAB_TRAVERSAL )
self.SetSizeHints( wx.DefaultSize, wx.DefaultSize )
bSizer1 = wx.BoxSizer( wx.VERTICAL )
self.panel = wx.Panel( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL )
self.mainSizer = wx.BoxSizer( wx.VERTICAL )
self.userName = wx.TextCtrl (self.panel, value="admin")
self.mainSizer.Add( self.userName, 0, wx.ALIGN_CENTRE|wx.ALL, 5 )
self.passwd = wx.TextCtrl (self.panel, value="admin")
self.mainSizer.Add( self.passwd, 0, wx.ALIGN_CENTRE|wx.ALL, 5 )
self.lgnButton = wx.Button(self.panel, label="Login")
self.mainSizer.Add( self.lgnButton, 0, wx.ALIGN_CENTRE|wx.ALL, 5 )
self.panel.SetSizer( self.mainSizer )
bSizer1.Add( self.panel, 1, wx.EXPAND |wx.ALL, 5 )
self.SetSizer( bSizer1 )
self.Layout()
self.Centre( wx.BOTH )
self.lgnButton.Bind(wx.EVT_BUTTON, self.attemptLogin)
示例7: SetTableValue
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ALIGN_CENTRE [as 别名]
def SetTableValue(self):
"""
Cell is filled by new parsing data
"""
sdo_list = ['idx', 'subIdx', 'access', 'type', 'size', 'category', 'name', 'value']
for row_idx in range(len(self.SDOs)):
for col_idx in range(len(self.SDOs[row_idx])):
self.SetCellValue(row_idx, col_idx, self.SDOs[row_idx][sdo_list[col_idx]])
self.SetReadOnly(row_idx, col_idx, True)
if col_idx < 5:
self.SetCellAlignment(row_idx, col_idx, wx.ALIGN_CENTRE, wx.ALIGN_CENTRE)
示例8: SetValue
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ALIGN_CENTRE [as 别名]
def SetValue(self, value):
"""
Set data in the table
@param value: EEPROM data list of which element is 1 Byte hex data
"""
# set label name and size
self.SetRowLabelSize(100)
for col in range(self.Col):
if col == 16:
self.SetColLabelValue(16, "Text View")
self.SetColSize(16, (self.GetSize().x-120)*4//20)
else:
self.SetColLabelValue(col, '%s' % col)
self.SetColSize(col, (self.GetSize().x-120)//20)
# set data into table
row = col = 0
for row_idx in value:
col = 0
self.SetRowLabelValue(row, "0x"+"{:0>4x}".format(row*(self.Col-1)))
for hex in row_idx:
self.SetCellValue(row, col, hex)
if col == 16:
self.SetCellAlignment(row, col, wx.ALIGN_LEFT, wx.ALIGN_CENTER)
else:
self.SetCellAlignment(row, col, wx.ALIGN_CENTRE, wx.ALIGN_CENTER)
self.SetReadOnly(row, col, True)
col = col + 1
row = row + 1
# -------------------------------------------------------------------------------
# For Register Access Panel
# -------------------------------------------------------------------------------
示例9: AddControls
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ALIGN_CENTRE [as 别名]
def AddControls(self):
vs = wx.BoxSizer(wx.VERTICAL)
self.int_ctrl = controls.CustomIntCtrl(self.frame)
self.txt_ctrl = wx.TextCtrl(self.frame)
vs.Add(self.int_ctrl, 0, wx.ALIGN_CENTRE | wx.ALL, 5)
vs.Add(self.txt_ctrl, 0, wx.ALIGN_CENTRE | wx.ALL, 5)
self.frame.SetSizer(vs)
vs.Fit(self.frame)
self.frame.Show()
self.frame.Raise()
self.min_val = 50
self.max_val = 100
self.int_ctrl.SetBounds(self.min_val, self.max_val)
self.ProcessEvents()
示例10: Normal
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ALIGN_CENTRE [as 别名]
def Normal(fontName="Arial"):
"""
Return a reasonable default format for a report
"""
fmt = ReportFormat()
fmt.PageHeader.Font = wx.FFont(24, wx.FONTFAMILY_DEFAULT, face=fontName)
fmt.PageHeader.TextAlignment = wx.ALIGN_CENTRE
fmt.PageHeader.Add(FrameDecoration(pen=wx.Pen(wx.BLUE, 1), space=5))
#fmt.PageHeader.Add(LineDecoration(pen=wx.Pen(wx.BLUE, 2), space=5))
fmt.ReportHeader.Font = wx.FFont(36, wx.FONTFAMILY_DEFAULT, face=fontName)
fmt.ReportHeader.TextColor = wx.RED
fmt.ReportHeader.Padding = (0, 12, 0, 12)
fmt.ListHeader.Add(LineDecoration(side=Decoration.BOTTOM, pen=wx.Pen(wx.GREEN, 1)))
fmt.PageFooter.Font = wx.FFont(12, wx.FONTFAMILY_DEFAULT, face=fontName)
fmt.PageFooter.TextAlignment = wx.ALIGN_RIGHT
fmt.PageFooter.Add(LineDecoration(side=Decoration.TOP, pen=wx.Pen(wx.BLUE, 1), space=3))
fmt.Row.Font = wx.FFont(12, wx.FONTFAMILY_DEFAULT, face=fontName)
#fmt.ColumnHeader.CellPadding=25
fmt.ColumnHeader.GridPen=wx.Pen(wx.RED, 1)
fmt.Row.CellPadding=(10, 10, 0, 10)
fmt.Row.GridPen=wx.Pen(wx.BLUE, 1)
#fmt.ColumnHeader.Add(FrameDecoration(pen=wx.Pen(wx.RED, 1)))
#fmt.Row.Add(FrameDecoration(pen=wx.Pen(wx.RED, 10)))
#fmt.Row.Add(LineDecoration(side=Decoration.BOTTOM, pen=wx.Pen(wx.GREEN, 1)))
return fmt
#======================================================================
示例11: GetColumnAlignments
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ALIGN_CENTRE [as 别名]
def GetColumnAlignments(self, olv, left, right):
"""
Return the alignments of the given slice of columns
"""
listAlignments = [olv.GetColumn(i).GetAlign() for i in range(left, right+1)]
mapping = {
wx.LIST_FORMAT_LEFT: wx.ALIGN_LEFT,
wx.LIST_FORMAT_RIGHT: wx.ALIGN_RIGHT,
wx.LIST_FORMAT_CENTRE: wx.ALIGN_CENTRE,
}
return [mapping[x] for x in listAlignments]
示例12: GetAlignments
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ALIGN_CENTRE [as 别名]
def GetAlignments(self):
"""
Return a list indicating how the text within each cell is aligned.
"""
if self.engine.alwaysCenterColumnHeader:
return [wx.ALIGN_CENTRE for i in range(self.left, self.right+1)]
else:
return self.GetColumnAlignments(olv, self.left, self.right)
示例13: GetColumnAlignments
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ALIGN_CENTRE [as 别名]
def GetColumnAlignments(self, lv, left, right):
"""
Return the alignments of the given slice of columns
"""
listAlignments = [lv.GetColumn(i).GetAlign() for i in range(left, right+1)]
mapping = {
wx.LIST_FORMAT_LEFT: wx.ALIGN_LEFT,
wx.LIST_FORMAT_RIGHT: wx.ALIGN_RIGHT,
wx.LIST_FORMAT_CENTRE: wx.ALIGN_CENTRE,
}
return [mapping[x] for x in listAlignments]
#----------------------------------------------------------------------------
示例14: set_scroll_content
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ALIGN_CENTRE [as 别名]
def set_scroll_content(self):
self.img_lst_v_sizer.Clear(True)
for lst_1d in self.lst_2d_bmp:
img_lst_hor_sizer = wx.BoxSizer(wx.HORIZONTAL)
for i, i_bmp in enumerate(lst_1d):
local_bitmap = wx.StaticBitmap(self, bitmap=i_bmp)
if self.parent_panel.local_bbox is None:
slice_string = "Slice[" + str(i) + ":" + str(i + 1) + ", :, :]"
else:
bbx = self.parent_panel.local_bbox
slice_string = "Image # " + str(bbx[4] + i)
slice_sub_info_txt = wx.StaticText(self, -1, slice_string)
sigle_slice_sizer = wx.BoxSizer(wx.VERTICAL)
sigle_slice_sizer.Clear(True)
sigle_slice_sizer.Add(
local_bitmap, proportion=0, flag=wx.ALIGN_CENTRE | wx.ALL, border=2
)
sigle_slice_sizer.Add(
slice_sub_info_txt,
proportion=0,
flag=wx.ALIGN_CENTRE | wx.ALL,
border=2,
)
img_lst_hor_sizer.Add(
sigle_slice_sizer,
proportion=0,
flag=wx.ALIGN_CENTER | wx.ALL,
border=2,
)
self.img_lst_v_sizer.Add(img_lst_hor_sizer, 0, wx.CENTER | wx.ALL, 10)
self.n_img += 1
self.parent_panel.Pframe.Layout()
self.SetScrollRate(1, 1)
示例15: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ALIGN_CENTRE [as 别名]
def __init__( self, parent ):
wx.Panel.__init__( self, parent, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL )
bSizer11 = wx.BoxSizer( wx.VERTICAL )
self.newUser = wx.Button (self, label="New User")
bSizer11.Add(self.newUser, 0, wx.ALIGN_CENTRE|wx.ALL, 5)
self.usersGrid = wx.grid.Grid( self, wx.ID_ANY, wx.DefaultPosition, wx.Size( -1,700 ), 0 )
p = self.populateTable()
lenP = len(p)
# Grid
self.usersGrid.CreateGrid( lenP, 3 )
self.usersGrid.EnableEditing( False )
self.usersGrid.EnableGridLines( True )
self.usersGrid.EnableDragGridSize( False )
self.usersGrid.SetMargins( 0, 0 )
# Populate Table
row=0
for x in p:
col=0
# if amount of invoice is smaller than the amount recieved yet, colour the cell red
for y in list(x.values()):
self.usersGrid.SetCellValue(row, col, str(y))
col = col+1
row = row+1
# Columns
self.usersGrid.SetColSize( 0, 30 )
self.usersGrid.SetColSize( 1, 100 )
#self.usersGrid.SetColSize( 2, 120 )
#self.usersGrid.AutoSizeColumns()
self.usersGrid.EnableDragColMove( True )
self.usersGrid.EnableDragColSize( True )
self.usersGrid.SetColLabelSize( 30 )
self.usersGrid.SetColLabelValue( 0, u"ID" )
self.usersGrid.SetColLabelValue( 1, u"Username" )
#self.usersGrid.SetColLabelValue( 2, u" " )
self.usersGrid.SetColLabelAlignment( wx.ALIGN_CENTRE, wx.ALIGN_CENTRE )
# Rows
self.usersGrid.EnableDragRowSize( False )
self.usersGrid.SetRowLabelSize( 1 )
self.usersGrid.SetRowLabelAlignment( wx.ALIGN_CENTRE, wx.ALIGN_CENTRE )
# Label Appearance
# Cell Defaults
self.usersGrid.SetDefaultCellAlignment( wx.ALIGN_CENTRE, wx.ALIGN_TOP )
bSizer11.Add( self.usersGrid, 0, wx.ALIGN_CENTRE|wx.ALL, 5 )
self.SetSizer( bSizer11 )
self.Layout()
bSizer11.Fit( self )
self.usersGrid.Bind( wx.grid.EVT_GRID_CELL_LEFT_CLICK, self.deleteUser )
self.newUser.Bind( wx.EVT_BUTTON, self.createNewUser )