2006年05月25日 星期四 23:30
有一个非标准表格(Grid),想打印出来,在wxPython demo 里面,能找到打印表格的例子,但是是标准的表格,还有一个是PrintFrame的例子,但是打印的内容是用 dc 来画的文字,和各种形状。 我测试过 wx.lib.printout 里面的PrintGrid,他是把grid转成标准的表格打印出来的。 想请教下,wxPython里面,要打印各种布局,例如demo 里面的 GridBagSizer 等等,要怎么处理呢?有没有相关的例程? 附上我的表格头: -------------------------------------------------------- class StatsSheet(gridlib.Grid): """设置统计表格头 """ def __init__(self, parent, salaryDict = {}, log = None, userDict = {}): gridlib.Grid.__init__(self, parent, -1, size = (800, -1)) self.salaryDict = salaryDict self.log = log #表格头属性:居中,只读 attr = self.attr = gridlib.GridCellAttr() attr.SetAlignment(wx.ALIGN_CENTRE, wx.ALIGN_CENTRE) attr.SetReadOnly(True) self.CreateGrid(3, 26)#, gridlib.Grid.SelectRows) self.SetMargins(0, 0) self.SetRowLabelSize(0) self.SetColLabelSize(0) for i in xrange(2): self.SetRowAttr(i, attr) ### Salary base sheet ### self.SetCellSize(0, 0, 2, 1) self.SetCellSize(0, 1, 2, 1) self.SetCellSize(0, 2, 2, 1) self.SetCellSize(0, 3, 2, 1) self.SetCellSize(0, 4, 1, 14) self.SetCellSize(0, 18, 1, 7) self.SetCellSize(0, 25, 2, 1) captions = [u"姓名", u"职级", u"定\n\r工\n\r资", u"浮\n\r动", u"执行工资", u"应扣款", u"实\n\r发\n\r工\n\r资"] j=0 for i in (0, 1, 2, 3, 4, 18, 25): self.SetCellValue(0, i, captions[j]) j += 1 self.SetCellSize(1, 7, 1, 10) self.SetCellSize(1, 18, 1, 3) captions = [u"缴费\n\r工资", u"房贴", u"通\n\r讯\n\r费", u"劳\n\r务\n\r费", u"合计", u"个人\n\r所得税", u"社\n\r保", u"公\n\r积\n\r金", u"其\n\r他", u"合计"] j = 0 for i in (4, 5, 6, 7, 17, 18, 21, 22, 23, 24): self.SetCellValue(1, i, captions[j]) j += 1 self.SetRowSize(1, 50) widths = [45, 45, 45, 30, 45, 30, 30, 30, 35, 35, 30, 20, 20, 20, 20, 20, 20, 20, 30, 35, 30, 30, 30, 30, 30, 45] for i in xrange(len(widths)): self.SetColSize(i, widths[i]) -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20060525/3ecb82b1/attachment.html
Zeuux © 2025
京ICP备05028076号