Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # fields: id, label, type, callback, row, column, width, defaults, status
- fields = (
- ('game', 'Game', 'LabelFrame', (
- ('id', 'Number', 'Entry', None, 0, 0, 5, '', 'normal'),
- ('winner', 'Winner', 'Combobox', None, 0, 1, 30, ['']+teams, 'normal'),
- ), 0, 0),
- ('teams', 'Teams', 'LabelFrame', (
- ('team1', 'Home Team', 'Combobox', team_name_filter, 0, 0, 30, ['']+teams, 'normal'),
- ('team2', 'Visitor Team', 'Combobox', team_name_filter, 1, 0, 30, ['']+teams, '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', None, 'Button', save, 0, 0, 10, 'Save', 'normal'),
- ('delete', None, 'Button', delete, 0, 1, 10, 'Delete', 'normal'),
- ('new', None, 'Button', new, 0, 2, 10, 'New', 'normal'),
- ('search', None, 'Button', search, 0, 3, 10, 'Search', 'normal'),
- ), 2, 0),
- ('team', 'Team', 'LabelFrame', (
- ('name', 'Team Name', 'Combobox', team_name_filter, 0, 0, 30, ['']+teams, 'normal'),
- ('players', 'Players', 'LabelFrame', (
- ('first_name', 'First Name', 'Entry', name_filter, 0, 0, 25, None, 'normal'),
- ('middle_name', 'Middle Name', 'Entry', name_filter, 0, 1, 25, None, 'normal'),
- ('last_name', 'Last Name', 'Entry', name_filter, 0, 2, 25, None, 'normal'),
- ('great_player', 'Great Player', 'Checkbutton', great_player, 1, 0, 25, 0, 'normal'),
- ('gender', 'Gender', 'Combobox', None, 1, 1, 25, ('Male', 'Female'), 'normal'),
- ('option', None, 'Radiobutton', option, 1, 2, 25, ('Option1', 'Option2', 'Option3'), 'normal'),
- ('processing', 'Progressing', 'Progressbar', None, 2, 0, 25, '', 'normal'),
- ), 2, 0),
- ('notebook', None, 'Notebook', None, 3, 0, 25, ('Tab One', 'Tab Two', 'Tab Three'), 'normal'),
- ), 3, 0),
- )
- form = Form(canvas1, table, fields)
- item = form.item
- item('game').grid(sticky='NSEW', columnspan=2)
- item('buttons').grid(sticky='NSEW', columnspan=2)
- for __, _item in form.groups().items():
- _item.grid(padx=2, pady=2)
- item('times/starttime').grid(sticky='NE')
- item('times/endtime').grid(sticky='NE')
- def gender_selected(event):
- messagebox.showinfo('Info', 'You have selected ' + event.widget.get())
- item('team').grid(sticky='NSEW', columnspan=2)
- item('team/name').grid(sticky='NW')
- item('team/players').grid(padx=2, pady=2)
- item('team/players/processing').grid(columnspan=5)
- item('team/players/gender').widget.bind("<<ComboboxSelected>>", gender_selected)
- def progress_bar():
- pb.bytes += 500
- pb["value"] = pb.bytes
- if pb.bytes < pb.maxbytes:
- pb.after(100, progress_bar)
- else:
- messagebox.showinfo('Info', 'Process Completed Successfully')
- pb = item('team/players/processing').widget
- pb.bytes = pb["value"] = 0
- pb.maxbytes = pb["maximum"] = 50000
- progress_bar()
- form.grid(sticky='NSEW')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement