我正在尝试使用 wx 网格构建发票,我想添加数量列中的值和价格列中的值并将其显示在行总计中。
import wx
import wx.grid as gridlib
class MyForm(wx.Frame):
def __init__(self):
wx.Frame.__init__(self, None, wx.ID_ANY, "Invoice")
datag = 0
# Add a panel so it looks the correct on all platforms
panel = wx.Panel(self, wx.ID_ANY)
grid = gridlib.Grid(panel)
grid.CreateGrid(25, 3)
note_sizer = wx.BoxSizer()
note_sizer.Add(grid, 1, wx.EXPAND)
panel.SetSizer(note_sizer)
# We can set the sizes of individual rows and columns
# in pixels
grid.SetColSize(0, 520)
# change a couple column labels
grid.SetColLabelValue(0, "Product")
grid.SetColLabelValue(1, "Quantity")
grid.SetColLabelValue(2, "Price")
grid.SetColFormatFloat(2)
grid.SetCellValue(24, 0, 'Total')
if __name__ == "__main__":
app = wx.App()
frame = MyForm().Show()
app.MainLoop()
谁能帮忙?