Beispiel #1
0
    def createTableFrame(self, callback=None):
        """Adds column header and scrollbars and combines them with
           the current table adding all to the master frame provided in constructor.
           Table is then redrawn."""

        #Add the table and header to the frame
        self.tablerowheader = LargeRowHeader(self.parentframe, self)
        self.tablecolheader = LargeColumnHeader(self.parentframe, self)
        self.Yscrollbar = AutoScrollbar(self.parentframe,
                                        orient=VERTICAL,
                                        command=self.set_yviews)
        self.Yscrollbar.grid(row=1,
                             column=2,
                             rowspan=1,
                             sticky='news',
                             pady=0,
                             ipady=0)
        self.Xscrollbar = AutoScrollbar(self.parentframe,
                                        orient=HORIZONTAL,
                                        command=self.set_xviews)
        self.Xscrollbar.grid(row=2, column=1, columnspan=1, sticky='news')
        self['xscrollcommand'] = self.Xscrollbar.set
        self['yscrollcommand'] = self.Yscrollbar.set
        self.tablecolheader['xscrollcommand'] = self.Xscrollbar.set
        self.tablerowheader['yscrollcommand'] = self.Yscrollbar.set
        self.parentframe.rowconfigure(1, weight=1)
        self.parentframe.columnconfigure(1, weight=1)

        self.tablecolheader.grid(row=0,
                                 column=1,
                                 rowspan=1,
                                 sticky='news',
                                 pady=0,
                                 ipady=0)
        self.tablerowheader.grid(row=1,
                                 column=0,
                                 rowspan=1,
                                 sticky='news',
                                 pady=0,
                                 ipady=0)
        self.grid(row=1, column=1, rowspan=1, sticky='news', pady=0, ipady=0)

        self.adjustColumnWidths()
        self.redrawTable(callback=callback)
        self.parentframe.bind("<Configure>", self.redrawVisible)
        self.tablecolheader.xview("moveto", 0)
        self.xview("moveto", 0)
        return