本文整理汇总了Python中wx.grid方法的典型用法代码示例。如果您正苦于以下问题:Python wx.grid方法的具体用法?Python wx.grid怎么用?Python wx.grid使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wx
的用法示例。
在下文中一共展示了wx.grid方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: wxname2attr
# 需要导入模块: import wx [as 别名]
# 或者: from wx import grid [as 别名]
def wxname2attr(self, name):
"""Return the attribute specified by the name. Only wx attributes are supported.
Example::
>>> self.wxname2attr('wx.version')
<function version at 0x2cc6398>
>>> self.wxname2attr('wx.VERSION')
(2, 8, 12, 1, '')
note: Exceptions especially NameError and AttributeError aren't caught."""
assert name.startswith('wx')
#cn = self.codegen.get_class(self.codegen.cn(name))
cn = self.codegen.cn(name)
namespace, cn = cn.rsplit(".",1)
if namespace=="wx":
import wx
return getattr(wx, cn)
if namespace=="wx.propgrid":
import wx.propgrid
return getattr(wx.propgrid, cn)
if namespace=="wx.grid":
import wx.grid
return getattr(wx.propgrid, cn)
raise ValueError("namespace %s not implemented"%namespace)
示例2: pdf_show
# 需要导入模块: import wx [as 别名]
# 或者: from wx import grid [as 别名]
def pdf_show(seite):
page_idx = getint(seite) - 1
pix = PDFcfg.doc.getPagePixmap(page_idx, matrix = scaling)
# the following method returns just RGB data - no alpha bytes
# this seems to be required in Windows versions of wx.
# on other platforms try instead:
#bmp = wx.BitmapfromBufferRGBA(pix.w, pix.h, pix.samples)
a = pix.samplesRGB() # samples without alpha bytes
bmp = wx.BitmapFromBuffer(pix.w, pix.h, a)
pix = None
a = None
return bmp
#==============================================================================
# PDFTable = a tabular grid class in wx
#==============================================================================
示例3: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import grid [as 别名]
def __init__(self):
gridlib.PyGridTableBase.__init__(self)
self.colLabels = ['Level','Title','Page']
self.dataTypes = [gridlib.GRID_VALUE_NUMBER,
gridlib.GRID_VALUE_STRING,
gridlib.GRID_VALUE_NUMBER,
]
# initial load of table with outline data
# each line consists of [lvl, title, page]
# for display, we "indent" the title with spaces
self.data = [[PDFcfg.inhalt[i][0], # indentation level
" "*(PDFcfg.inhalt[i][0] -1) + \
PDFcfg.inhalt[i][1].decode("utf-8","ignore"), # title
PDFcfg.inhalt[i][2]] \
for i in range(len(PDFcfg.inhalt))]
if not PDFcfg.inhalt:
self.data = [[0, "*** no outline ***", 0]]
# used for correctly placing new lines. insert at end = -1
self.cur_row = -1
#==============================================================================
# Methods required by wxPyGridTableBase interface.
# Will be called by the grid.
#==============================================================================
示例4: NewRow
# 需要导入模块: import wx [as 别名]
# 或者: from wx import grid [as 别名]
def NewRow(self, zeile):
grid = self.GetView()
if grid:
if self.cur_row in range(len(self.data)): # insert in the middle?
self.data.insert(self.cur_row, zeile)
grid.BeginBatch() # inform the grid
msg = gridlib.GridTableMessage(self,
gridlib.GRIDTABLE_NOTIFY_ROWS_INSERTED, self.cur_row, 1)
grid.ProcessTableMessage(msg)
grid.EndBatch()
else: # insert at end (append)
self.data.append(zeile)
grid.BeginBatch() # inform grid
msg = gridlib.GridTableMessage(self,
gridlib.GRIDTABLE_NOTIFY_ROWS_APPENDED, 1)
grid.ProcessTableMessage(msg)
grid.EndBatch()
#==============================================================================
# Duplicate a row, called with row number
#==============================================================================
示例5: DuplicateRow
# 需要导入模块: import wx [as 别名]
# 或者: from wx import grid [as 别名]
def DuplicateRow(self, row):
grid = self.GetView()
if grid:
zeile = [self.data[row][0], self.data[row][1],
self.data[row][2], self.data[row][3],
self.data[row][4]]
self.data.insert(row, zeile)
grid.BeginBatch()
msg = gridlib.GridTableMessage(
self, gridlib.GRIDTABLE_NOTIFY_ROWS_INSERTED, row, 1)
grid.ProcessTableMessage(msg)
grid.EndBatch()
#==============================================================================
# Remove a row
#==============================================================================
示例6: _updateColAttrs
# 需要导入模块: import wx [as 别名]
# 或者: from wx import grid [as 别名]
def _updateColAttrs(self, grid):
"""
wx.grid.Grid -> update the column attributes to add the
appropriate renderer given the column name.
Otherwise default to the default renderer.
"""
for row in range(self.GetNumberRows()):
for col in range(self.GetNumberCols()):
editor = wx.grid.GridCellTextEditor()
renderer = wx.grid.GridCellStringRenderer()
grid.SetReadOnly(row, col, self.Parent.Editable)
grid.SetCellEditor(row, col, editor)
grid.SetCellRenderer(row, col, renderer)
grid.SetCellBackgroundColour(row, col, wx.WHITE)
示例7: OnIdle
# 需要导入模块: import wx [as 别名]
# 或者: from wx import grid [as 别名]
def OnIdle(self, evt):
dlg = self.GetParent()
if self.do_title: # did title changes happen?
self.AutoSizeColumn(1) # resize title column
w1 = max(self.GetEffectiveMinSize()[0], dlg.minwidth)
w2 = dlg.PDFbild.Size[0]
h = dlg.Size[1]
dlg.Size = wx.Size(w1 + w2 + 60, h)
dlg.Layout() # adjust the grid
self.do_title = False
if self.bookmark > 0: # did height changes happen?
self.GetTable().SetValue(self.bookmark_row, 3, self.bookmark)
self.Table.data[self.bookmark_row][3] = self.bookmark
spad.oldpage = 0 # make sure page re-display
PicRefresh(dlg, self.bookmark_page)
self.bookmark = -1
if (time.clock() - spad.lastsave) > 60.0 and spad.lastsave >= 0.0:
dlg.auto_save()
evt.Skip()
#==============================================================================
# Event Method: cell is changing
#==============================================================================
示例8: OnCellDClick
# 需要导入模块: import wx [as 别名]
# 或者: from wx import grid [as 别名]
def OnCellDClick(self, evt):
row = evt.GetRow() # row
col = evt.GetCol() # col
dlg = self.GetParent()
seite = self.GetTable().GetValue(row, 2) # make sure page is displayed
PicRefresh(dlg, seite)
if col != 3: # further handling only for height col
evt.Skip()
return
self.bookmark_page = self.GetTable().GetValue(row, 2) # store page no
self.bookmark_row = row # store grid row
self.MakeCellVisible(row, col)
h = self.GetTable().GetValue(row, 3) # get current height value
h = max(int(h), 1) # should be > 0
maxh = spad.height # maxh is page height
d = Slider(self, h, maxh) # create slider dialog
d.ShowModal() # show it
self.bookmark = d.slider.GetValue() # extract & store value
evt.Skip()
return
#==============================================================================
# Event Method: move row
#==============================================================================
示例9: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import grid [as 别名]
def __init__(self, parent, nodelist):
Grid.__init__(self, parent, style=wx.WANTS_CHARS)
self.CreateGrid( 0, 2, wx.grid.Grid.SelectRows)
self.SetColLabelValue(0, _("Host"))
self.SetColLabelValue(1, _("Port"))
self.SetColRenderer(1, wx.grid.GridCellNumberRenderer())
self.SetColEditor(1, wx.grid.GridCellNumberEditor(0, 65535))
self.SetColLabelSize(self.GetTextExtent("l")[1]+4)
self.SetRowLabelSize(1)
self.SetSize((1000,1000))
self.storing = False
self.Bind(wx.grid.EVT_GRID_CMD_CELL_CHANGE, self.store_value)
self.append_node(('router.bittorrent.com', '65536'))
for i, e in enumerate(nodelist.split(',')):
host, port = e.split(':')
self.append_node((host,port))
self.append_node(('',''))
示例10: AddOption
# 需要导入模块: import wx [as 别名]
# 或者: from wx import grid [as 别名]
def AddOption(self, size, lib, foot):
s = wx.SpinCtrlDouble(self.grid, value=str(size), inc=0.1)
self.gridSizer.Add(s)
print("lib {} foot {}".format(lib, foot))
l = wx.StaticText(self.grid, label=lib)
self.gridSizer.Add(l, proportion=1)
f = wx.StaticText(self.grid, label=foot)
self.gridSizer.Add(f, proportion=1)
b = wx.Button(self.grid, label="remove")
self.gridSizer.Add(b)
b.Bind(wx.EVT_BUTTON, self.OnRemove)
self.therows[b.GetId()] = (s,l,f,b)
示例11: Delete
# 需要导入模块: import wx [as 别名]
# 或者: from wx import grid [as 别名]
def Delete(self, rows):
"""
Delete(rows) expects rows in reverse sorted order
"""
query=pgQuery(self.tableSpecs.tabName, self.tableSpecs.GetCursor())
all=[]
for row in rows:
wh=[]
for colname in self.tableSpecs.keyCols:
wh.append("%s=%s" % (quoteIdent(colname), quoteValue(self.rows[row][colname])))
all.append("(%s)" % " AND ".join(wh))
query.AddWhere("\n OR ".join(all))
rc=query.Delete()
self.grid.Freeze()
self.grid.BeginBatch()
for row in rows:
self.grid.DeleteRows(row, 1, True)
# msg=wx.grid.GridTableMessage(self, wx.grid.GRIDTABLE_NOTIFY_ROWS_APPENDED)
self.grid.EndBatch()
self.grid.ForceRefresh()
self.grid.Thaw()
return rc
示例12: CreateSyncManagerTable
# 需要导入模块: import wx [as 别名]
# 或者: from wx import grid [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()
示例13: OnButtonXmlToEEPROMImg
# 需要导入模块: import wx [as 别名]
# 或者: from wx import grid [as 别名]
def OnButtonXmlToEEPROMImg(self, event):
"""
Create EEPROM data based XML data that current imported
Binded to 'XML to EEPROM' button.
@param event : wx.EVT_BUTTON object
"""
self.SiiBinary = self.Controler.CommonMethod.XmlToEeprom()
self.HexCode, self.HexRow, self.HexCol = self.Controler.CommonMethod.HexRead(self.SiiBinary)
self.UpdateSiiGridTable(self.HexRow, self.HexCol)
self.SiiGrid.SetValue(self.HexCode)
self.SiiGrid.Update()
# -------------------------------------------------------------------------------
# For Hex View grid (fill hex data)
# -------------------------------------------------------------------------------
示例14: __init_data
# 需要导入模块: import wx [as 别名]
# 或者: from wx import grid [as 别名]
def __init_data(self):
"""
Declare initial data.
"""
# flag for compact view
self.CompactFlag = False
# main grid의 rows and cols
self.MainRow = [512, 512, 512, 512]
self.MainCol = 4
# main grids' data range
self.PageRange = []
for index in range(4):
self.PageRange.append([512*index, 512*(index+1)])
# Previous value of register data for register description configuration
self.PreRegSpec = {"ESCType": "",
"FMMUNumber": "",
"SMNumber": "",
"PDIType": ""}
示例15: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import grid [as 别名]
def __init__(self, parent, row, col, controler):
"""
Constructor
@param parent: RegisterNotebook object
@param row, col: size of the table
@param controler: _EthercatSlaveCTN class in EthercatSlave.py
"""
self.parent = parent
self.Data = {}
self.Row = row
self.Col = col
self.Controler = controler
self.RegisterAccessPanel = self.parent.parent.parent
wx.grid.Grid.__init__(self, parent, -1, size=(820, 300),
style=wx.EXPAND | wx.ALIGN_CENTRE_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL)
for evt, mapping_method in [(wx.grid.EVT_GRID_CELL_LEFT_CLICK, self.OnSelectCell),
(wx.grid.EVT_GRID_CELL_LEFT_CLICK, self.OnSelectCell),
(wx.grid.EVT_GRID_CELL_LEFT_DCLICK, self.OnRegModifyDialog)]:
self.Bind(evt, mapping_method)