Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def forms_test_page(self):
- wm = self.window_manager
- page_name = 'Forms Test Page'
- pg, page_cached = wm.page(page_name)
- if not page_cached:
- pg.config(bg='purple')
- pane = PanedWindow(pg, bg=self.__sidebar_bg, borderwidth=0, orient='vertical')
- pane.grid(sticky='NSEW')
- canvas1 = Canvas(pane, borderwidth=0, highlightthickness=0)
- canvas1.rowconfigure(0, weight=1)
- canvas1.columnconfigure(0, weight=1)
- canvas1.config(bg='purple')
- pane.add(canvas1)
- canvas = Canvas(pane, borderwidth=0, highlightthickness=0)
- canvas.rowconfigure(0, weight=1)
- canvas.columnconfigure(0, weight=1)
- pane.add(canvas)
- frame = Frame(canvas)
- frame.rowconfigure(1, weight=1)
- frame.columnconfigure(0, weight=1)
- frame.grid(row=0, column=0, sticky='NSEW')
- f1 = Frame(frame)
- f1.rowconfigure(0, weight=1)
- f1.columnconfigure(0, weight=1)
- f1.grid(row=0, column=0, sticky='NEW')
- f2 = Frame(frame)
- f2.rowconfigure(0, weight=1)
- f2.columnconfigure(0, weight=1)
- f2.grid(row=1, column=0, sticky='NSEW')
- Label(
- f1,
- text='Season Win/Loss',
- font=("Helvetica", 15),
- bg='white'
- ).grid(sticky='EW')
- columns = (
- {'id': '#0', 'anchor': 'w'},
- {'id': 'id'},
- {'id': 'starttime'},
- {'id': 'endtime'},
- {'id': 'totaltime'},
- {'id': 'minutes'},
- {'id': 'team1', 'width': 150},
- {'id': 'team2', 'width': 150},
- {'id': 'winner', 'width': 150}
- )
- headings = (
- {'id': '#0', 'text': '#', 'anchor': 'w'},
- {'id': 'id', 'text': 'ID'},
- {'id': 'starttime', 'text': 'Start Time'},
- {'id': 'endtime', 'text': 'End Time'},
- {'id': 'totaltime', 'text': 'Total Time'},
- {'id': 'minutes', 'text': 'Minutes'},
- {'id': 'team1', 'text': 'Team1'},
- {'id': 'team2', 'text': 'Team2'},
- {'id': 'winner', 'text': 'Winner'}
- )
- table_data = self.table_data
- table = TableView(f2, headings, columns)
- table['show'] = 'headings'
- for i, row in enumerate(table_data, 1):
- tag = 'even' if i % 2 else 'odd'
- table.insert('', 'end', values=row, tags=(tag,))
- def save():
- messagebox.showinfo('Test', 'Save popup')
- def delete():
- messagebox.showinfo('Test', 'Delete popup')
- def new():
- messagebox.showinfo('Test', 'New popup')
- def search():
- messagebox.showinfo('Test', 'Search popup')
- bindings = (
- ('game', 'Game', 'LabelFrame', (
- ('id', 'Number', 'Entry', None, 0, 0, 5, '', 'normal'),
- ('winner', 'Winning Team', 'Entry', None, 0, 1, 30, '', 'normal'),
- ), 0, 0),
- ('teams', 'Teams', 'LabelFrame', (
- ('team1', 'Home Team', 'Entry', None, 0, 0, 30, '', 'normal'),
- ('team2', 'Visitor Team', 'Entry', None, 1, 0, 30, '', 'normal'),
- ), 1, 0),
- ('times', 'Times', 'LabelFrame', (
- ('starttime', 'Start', 'Entry', None, 0, 0, 10, '', 'normal'),
- ('endtime', 'Finish', 'Entry', None, 0, 1, 10, '', 'normal'),
- ('totaltime', 'Total Time', 'Entry', None, 1, 0, 10, '', 'normal'),
- ('minutes', 'Minutes Played', 'Entry', None, 1, 1, 10, '', 'normal'),
- ), 1, 1,),
- ('buttons', '', 'LabelFrame', (
- ('save', 'Save', 'Button', save, 0, 0, 10, 'normal'),
- ('delete', 'Delete', 'Button', delete, 0, 1, 10, 'normal'),
- ('new', 'New', 'Button', new, 0, 2, 10, 'normal'),
- ('search', 'Search', 'Button', search, 0, 3, 10, 'normal'),
- ), 2, 0),
- )
- form = Form(canvas1, table, bindings)
- form.group('game').grid(sticky='EW', columnspan=2)
- form.group('buttons').grid(sticky='EW', columnspan=2)
- for __, item in form.groups().items():
- item.grid(padx=2, pady=2)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement