Advertisement
Uno-Dan

Untitled

May 9th, 2018
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 3.20 KB | None | 0 0
  1. # fields: id, label, type, callback, row, column, width, defaults, status
  2. fields = (
  3.     ('game', 'Game', 'LabelFrame', (
  4.         ('id', 'Number', 'Entry', None, 0, 0, 5, '', 'normal'),
  5.         ('winner', 'Winner', 'Combobox', None, 0, 1, 30, ['']+teams, 'normal'),
  6.     ), 0, 0),
  7.     ('teams', 'Teams', 'LabelFrame', (
  8.         ('team1', 'Home Team', 'Combobox', team_name_filter, 0, 0, 30, ['']+teams, 'normal'),
  9.         ('team2', 'Visitor Team', 'Combobox', team_name_filter, 1, 0, 30, ['']+teams, 'normal'),
  10.     ), 1, 0),
  11.     ('times', 'Times', 'LabelFrame', (
  12.         ('starttime', 'Start', 'Entry', None, 0, 0, 10, '', 'normal'),
  13.         ('endtime', 'Finish', 'Entry', None, 0, 1, 10, '', 'normal'),
  14.         ('totaltime', 'Total Time', 'Entry', None, 1, 0, 10, '', 'normal'),
  15.         ('minutes', 'Minutes Played', 'Entry', None, 1, 1, 10, '', 'normal'),
  16.     ), 1, 1,),
  17.     ('buttons', '', 'LabelFrame', (
  18.         ('save', None, 'Button', save, 0, 0, 10, 'Save', 'normal'),
  19.         ('delete', None, 'Button', delete, 0, 1, 10, 'Delete', 'normal'),
  20.         ('new', None, 'Button', new, 0, 2, 10, 'New', 'normal'),
  21.         ('search', None, 'Button', search, 0, 3, 10, 'Search', 'normal'),
  22.     ), 2, 0),
  23.     ('team', 'Team', 'LabelFrame', (
  24.         ('name', 'Team Name', 'Combobox', team_name_filter, 0, 0, 30, ['']+teams, 'normal'),
  25.         ('players', 'Players', 'LabelFrame', (
  26.             ('first_name', 'First Name', 'Entry', name_filter, 0, 0, 25, None, 'normal'),
  27.             ('middle_name', 'Middle Name', 'Entry', name_filter, 0, 1, 25, None, 'normal'),
  28.             ('last_name', 'Last Name', 'Entry', name_filter, 0, 2, 25, None, 'normal'),
  29.             ('great_player', 'Great Player', 'Checkbutton', great_player, 1, 0, 25, 0, 'normal'),
  30.             ('gender', 'Gender', 'Combobox', None, 1, 1, 25, ('Male', 'Female'), 'normal'),
  31.             ('option', None, 'Radiobutton', option, 1, 2, 25, ('Option1', 'Option2', 'Option3'), 'normal'),
  32.             ('processing', 'Progressing', 'Progressbar', None, 2, 0, 25, '', 'normal'),
  33.         ), 2, 0),
  34.         ('notebook', None, 'Notebook', None, 3, 0, 25, ('Tab One', 'Tab Two', 'Tab Three'), 'normal'),
  35.     ), 3, 0),
  36. )
  37. form = Form(canvas1, table, fields)
  38.  
  39. item = form.item
  40. item('game').grid(sticky='NSEW', columnspan=2)
  41. item('buttons').grid(sticky='NSEW', columnspan=2)
  42.  
  43. for __, _item in form.groups().items():
  44.     _item.grid(padx=2, pady=2)
  45.  
  46. item('times/starttime').grid(sticky='NE')
  47. item('times/endtime').grid(sticky='NE')
  48.  
  49. def gender_selected(event):
  50.     messagebox.showinfo('Info', 'You have selected ' + event.widget.get())
  51.  
  52. item('team').grid(sticky='NSEW', columnspan=2)
  53. item('team/name').grid(sticky='NW')
  54. item('team/players').grid(padx=2, pady=2)
  55. item('team/players/processing').grid(columnspan=5)
  56. item('team/players/gender').widget.bind("<<ComboboxSelected>>", gender_selected)
  57.  
  58. def progress_bar():
  59.     pb.bytes += 500
  60.     pb["value"] = pb.bytes
  61.     if pb.bytes < pb.maxbytes:
  62.         pb.after(100, progress_bar)
  63.     else:
  64.         messagebox.showinfo('Info', 'Process Completed Successfully')
  65.  
  66. pb = item('team/players/processing').widget
  67. pb.bytes = pb["value"] = 0
  68. pb.maxbytes = pb["maximum"] = 50000
  69. progress_bar()
  70.  
  71. form.grid(sticky='NSEW')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement