Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from tkinter import messagebox
- from tkapp.base import App
- from tkapp.constants import LAST_ROW, LAST_COLUMN
- def main():
- defaults = {
- 'window1': {
- 'type': 'Frame',
- 'window_title': 'Demo App1',
- 'auto_save': True,
- 'auto_start': False,
- 'scrollbars': False,
- 'save_geometry': True,
- 'sticky': 'nsew',
- 'content': {
- 'type': 'PanedWindow',
- 'orient': 'horizontal',
- 'sashwidth': 2,
- 'background': '#000000',
- 'sticky': 'nsew',
- 'left_pane': {
- 'type': 'Frame',
- 'treeview': {
- 'type': 'Treeview',
- 'rowspan': 9899,
- 'column': 0,
- 'label': 'Pages',
- 'scrollbars': 'vertical',
- 'items': {
- 'demos': {
- 'label': 'Demos',
- 'children': {
- '3d_demo': {
- 'label': '3D Demo'
- },
- 'animation_demo': {
- 'label': 'Animation Demo'
- },
- 'animation_demo_two': {
- 'label': 'Animation Demo Two'
- }
- }
- },
- 'statistics': {
- 'label': 'Statistics',
- 'children': {
- 'season_win_loss': {
- 'label': 'Season Win\\Loss'
- },
- 'season_game_times': {
- 'label': 'Season Game Times'
- }
- }
- },
- 'templates': {
- 'label': 'Templates',
- 'children': {
- 'template1': {
- 'label': 'Template 1'
- },
- 'template2': {
- 'label': 'Template 2'
- },
- 'template3': {
- 'label': 'Template 3'
- }
- }
- },
- },
- 'sticky': 'NSEW'
- }
- },
- 'middle_pane': {
- 'type': 'Frame',
- 'rowconfigure': LAST_ROW,
- 'entry1': {
- 'type': 'Entry',
- 'label': ' Label 1 ',
- 'label_anchor': 'w'
- },
- 'load_defaults': {
- 'type': 'Checkbutton',
- 'row': 3,
- 'label': 'Load Defaults',
- 'value': 1,
- },
- 'radio_buttons': {
- 'type': 'Radiobutton',
- 'row': 4,
- 'value': 1,
- 'items': ('Button1', 'Button2')
- },
- 'combobox': {
- 'type': 'Combobox',
- 'row': 5,
- 'items': ('', 'Your Item1', 'Your Item2')
- },
- 'spinbox': {
- 'row': 6,
- 'column': 0,
- 'columnspan': 9900,
- 'pady': 5,
- 'type': 'Spinbox',
- 'label': 'Spinbox',
- 'label_anchor': 'w',
- 'to': 10,
- 'from_': 0,
- 'value': '7',
- 'wrap': True,
- 'sticky': 'w',
- },
- 'progress': {
- 'type': 'Frame',
- 'row': 7,
- 'padx': 5,
- 'pady': 5,
- 'sticky': 'w',
- 'columnconfigure': 1,
- 'start': {
- 'type': 'Button',
- 'padx': [0, 5],
- 'text': 'Start Process',
- 'sticky': 'W'
- },
- 'bar': {
- 'type': 'Progressbar',
- 'column': 1,
- 'sticky': 'EW',
- 'value': 0,
- 'maximum': 50000,
- 'refresh_rate': 50,
- }
- },
- 'sep1': {
- 'type': 'Separator',
- 'row': 8,
- 'pady': 5,
- 'columnspan': LAST_COLUMN,
- 'orient': 'horizontal',
- 'sticky': 'EW'
- },
- 'notebook': {
- 'type': 'Notebook',
- 'row': 9,
- 'sticky': 'NW',
- 'items': {
- 'one': {
- 'label': 'One',
- 'content': {
- 'type': 'Frame',
- 'sticky': 'NEW',
- 'wrap': {
- 'type': 'LabelFrame',
- 'label': 'Group Title',
- 'sticky': 'NEW',
- 'padx': 5,
- 'pady': 5,
- 'ipadx': 5,
- 'ipady': 5,
- 'entry': {
- 'type': 'Entry',
- 'columnspan': 9900,
- 'label': 'Entry Label 3',
- 'label_width': 12,
- 'label_anchor': 'e',
- 'value': 'My Entry Text'
- },
- 'quantity': {
- 'type': 'Combobox',
- 'row': 1,
- 'columnspan': 9900,
- 'pady': [
- 5,
- 0
- ],
- 'label': 'Quantity',
- 'label_width': 12,
- 'label_anchor': 'e',
- 'items': [
- 'One',
- 'Two',
- 'Three',
- 'Four',
- 'Five'
- ],
- 'value': 1
- },
- 'spinbox': {
- 'row': 2,
- 'column': 0,
- 'columnspan': 9900,
- 'pady': 5,
- 'type': 'Spinbox',
- 'label': 'Spinbox',
- 'label_width': 12,
- 'label_anchor': 'e',
- 'to': 10,
- 'from_': 0,
- 'value': '7',
- 'wrap': True
- },
- 'sep1': {
- 'type': 'Separator',
- 'row': 3,
- 'pady': [
- 5,
- 0
- ],
- 'columnspan': 9900,
- 'orient': 'horizontal',
- 'columnconfigure': 1,
- 'sticky': 'EW'
- },
- 'checkbutton': {
- 'type': 'Checkbutton',
- 'row': 4,
- 'label': 'Check Me',
- 'label_width': 12,
- 'label_anchor': 'e',
- 'value': 0,
- 'onvalue': 1,
- 'highlightthickness': 0
- },
- 'sep2': {
- 'type': 'Separator',
- 'row': 4,
- 'column': 1,
- 'orient': 'vertical',
- 'sticky': 'NS'
- },
- 'radiobutton': {
- 'type': 'Radiobutton',
- 'row': 4,
- 'column': 2,
- 'items': [
- 'one',
- 'two',
- 'three'
- ],
- 'value': 0,
- 'sticky': 'w'
- }
- },
- 'progress': {
- 'type': 'Frame',
- 'row': 2,
- 'padx': 5,
- 'pady': 5,
- 'columnconfigure': 1,
- 'start': {
- 'type': 'Button',
- 'padx': [
- 0,
- 5
- ],
- 'text': 'Start Process',
- 'sticky': 'W'
- },
- 'bar': {
- 'type': 'Progressbar',
- 'column': 1,
- 'sticky': 'EW',
- 'value': 0,
- 'maximum': 500000,
- 'refresh_rate': 50,
- }
- },
- 'lscale': {
- 'type': 'Label',
- 'row': 3,
- 'value': 0,
- 'sticky': 'EW'
- },
- 'scale': {
- 'type': 'Scale',
- 'row': 4,
- 'padx': [
- 5,
- 0
- ],
- 'to': 100,
- 'from_': 0,
- 'length': 300,
- 'value': 51
- }
- }
- },
- 'two': {
- 'label': 'Two',
- 'content': {
- 'type': 'LabelFrame',
- 'label': 'Group Title',
- 'padx': 5,
- 'pady': 5,
- 'ipadx': 5,
- 'ipady': 5,
- 'sticky': 'NEW',
- 'columnconfigure': 1,
- 'entry': {
- 'type': 'Entry',
- 'columnspan': 9900,
- 'label': 'Entry Label 3',
- 'label_anchor': 'e',
- 'value': 'My Entry Text'
- },
- 'spinbox': {
- 'row': 2,
- 'column': 0,
- 'columnspan': 9900,
- 'pady': 5,
- 'type': 'Spinbox',
- 'label': 'Spinbox',
- 'label_anchor': 'e',
- 'to': 10,
- 'from_': 0,
- 'value': '7',
- 'wrap': True
- },
- 'checkbutton': {
- 'type': 'Checkbutton',
- 'row': 3,
- 'label': 'Check Me',
- 'label_anchor': 'e',
- 'value': 0,
- 'onvalue': 1
- },
- 'sep1': {
- 'type': 'Separator',
- 'row': 3,
- 'column': 1,
- 'orient': 'vertical',
- 'sticky': 'NS'
- },
- 'radiobutton': {
- 'type': 'Radiobutton',
- 'row': 3,
- 'column': 2,
- 'items': [
- 'one',
- 'two',
- 'three'
- ],
- 'value': 0,
- 'sticky': 'w'
- },
- 'sep2': {
- 'type': 'Separator',
- 'row': 4,
- 'pady': [
- 5,
- 0
- ],
- 'columnspan': 9900,
- 'orient': 'horizontal',
- 'columnconfigure': 1,
- 'sticky': 'EW'
- },
- 'tabs': {
- 'row': 5,
- 'column': 0,
- 'columnspan': 9900,
- 'pady': [
- 5,
- 0
- ],
- 'type': 'Notebook',
- 'sticky': 'NSEW',
- 'items': {
- 'one': {
- 'label': 'Tab1',
- 'content': {
- 'type': 'LabelFrame',
- 'label': 'Group Title',
- 'padx': 5,
- 'pady': 5,
- 'ipadx': 5,
- 'ipady': 5,
- 'sticky': 'NSEW',
- 'columnconfigure': 1,
- 'entry': {
- 'type': 'Entry',
- 'columnspan': 9900,
- 'label': 'Entry Label 3',
- 'label_width': 12,
- 'label_anchor': 'e',
- 'value': 'My Entry Text'
- },
- 'spinbox': {
- 'row': 2,
- 'column': 0,
- 'columnspan': 9900,
- 'pady': 5,
- 'type': 'Spinbox',
- 'label': 'Spinbox',
- 'label_width': 12,
- 'label_anchor': 'e',
- 'to': 10,
- 'from_': 0,
- 'value': '7',
- 'wrap': True
- },
- 'checkbutton': {
- 'type': 'Checkbutton',
- 'row': 3,
- 'label': 'Check Me',
- 'label_width': 12,
- 'label_anchor': 'e',
- 'value': 0,
- 'onvalue': 1
- },
- 'sep1': {
- 'type': 'Separator',
- 'row': 3,
- 'column': 1,
- 'orient': 'vertical',
- 'sticky': 'NS'
- },
- 'radiobutton': {
- 'type': 'Radiobutton',
- 'row': 3,
- 'column': 2,
- 'items': [
- 'one',
- 'two',
- 'three'
- ],
- 'value': 0,
- 'sticky': 'w'
- }
- }
- },
- 'two': {
- 'label': 'Tab2',
- 'content': {
- 'type': 'LabelFrame',
- 'label': 'Group Title',
- 'padx': 5,
- 'pady': 5,
- 'ipadx': 5,
- 'ipady': 5,
- 'sticky': 'NSEW',
- 'entry': {
- 'type': 'Entry',
- 'columnspan': 9900,
- 'label': 'Entry Label 3',
- 'label_width': 12,
- 'label_anchor': 'e',
- 'value': 'My Entry Text'
- },
- 'spinbox': {
- 'row': 2,
- 'column': 0,
- 'columnspan': 9900,
- 'pady': 5,
- 'type': 'Spinbox',
- 'label': 'Spinbox',
- 'label_width': 12,
- 'label_anchor': 'e',
- 'to': 10,
- 'from_': 0,
- 'value': '7',
- 'wrap': True
- },
- 'checkbutton': {
- 'type': 'Checkbutton',
- 'row': 3,
- 'label': 'Check Me',
- 'label_width': 12,
- 'label_anchor': 'e',
- 'value': 0,
- 'onvalue': 1
- },
- 'sep1': {
- 'type': 'Separator',
- 'row': 3,
- 'column': 1,
- 'orient': 'vertical',
- 'sticky': 'NS'
- },
- 'radiobutton': {
- 'type': 'Radiobutton',
- 'row': 3,
- 'column': 2,
- 'items': [
- 'one',
- 'two',
- 'three'
- ],
- 'value': 0,
- 'sticky': 'w'
- }
- }
- },
- 'three': {
- 'label': 'Tab3',
- 'content': {
- 'type': 'LabelFrame',
- 'label': 'Group Title',
- 'padx': 5,
- 'pady': 5,
- 'ipadx': 5,
- 'ipady': 5,
- 'sticky': 'NSEW',
- 'entry': {
- 'type': 'Entry',
- 'columnspan': 9900,
- 'label': 'Entry Label 3',
- 'label_width': 12,
- 'label_anchor': 'e',
- 'value': 'Some more Text'
- },
- 'spinbox': {
- 'row': 2,
- 'column': 0,
- 'columnspan': 9900,
- 'pady': 5,
- 'type': 'Spinbox',
- 'label': 'Spinbox',
- 'label_width': 12,
- 'label_anchor': 'e',
- 'to': 10,
- 'from_': 0,
- 'value': '8',
- 'wrap': True
- },
- 'sep1': {
- 'type': 'Separator',
- 'row': 3,
- 'pady': [
- 5,
- 0
- ],
- 'columnspan': 9900,
- 'orient': 'horizontal',
- 'columnconfigure': 1,
- 'sticky': 'EW'
- },
- 'checkbutton': {
- 'type': 'Checkbutton',
- 'row': 4,
- 'label': 'Check Me',
- 'label_width': 12,
- 'label_anchor': 'e',
- 'value': 0,
- 'onvalue': 1
- },
- 'radiobutton': {
- 'type': 'Radiobutton',
- 'row': 4,
- 'column': 2,
- 'items': [
- 'one',
- 'two',
- 'three'
- ],
- 'value': 0,
- 'sticky': 'w'
- }
- }
- }
- }
- }
- }
- }
- }
- },
- },
- }
- },
- 'window2': {
- 'type': 'Frame',
- 'window_title': 'Demo App2',
- 'auto_save': True,
- 'auto_start': False,
- 'scrollbars': False,
- 'save_geometry': True,
- 'sticky': 'nsew',
- 'content': {
- 'type': 'PanedWindow',
- 'orient': 'horizontal',
- 'sashwidth': 2,
- 'background': '#000000',
- 'sticky': 'nsew',
- 'left_pane': {
- 'type': 'Frame',
- 'treeview': {
- 'type': 'Treeview',
- 'rowspan': 9899,
- 'column': 0,
- 'label': 'Pages',
- 'scrollbars': 'vertical',
- 'items': {
- 'demos': {
- 'label': 'Demos',
- 'children': {
- '3d_demo': {
- 'label': '3D Demo'
- },
- 'animation_demo': {
- 'label': 'Animation Demo'
- },
- 'animation_demo_two': {
- 'label': 'Animation Demo Two'
- }
- }
- },
- 'statistics': {
- 'label': 'Statistics',
- 'children': {
- 'season_win_loss': {
- 'label': 'Season Win\\Loss'
- },
- 'season_game_times': {
- 'label': 'Season Game Times'
- }
- }
- },
- 'templates': {
- 'label': 'Templates',
- 'children': {
- 'template1': {
- 'label': 'Template 1'
- },
- 'template2': {
- 'label': 'Template 2'
- },
- 'template3': {
- 'label': 'Template 3'
- }
- }
- },
- 'templates1': {
- 'label': 'Templates1',
- 'children': {
- 'template1a': {
- 'label': 'Template 1'
- }
- }
- },
- 'templates2': {
- 'label': 'Templates2',
- 'children': {
- 'template2a': {
- 'label': 'Template 2'
- }
- }
- },
- 'templates3': {
- 'label': 'Templates3',
- 'children': {
- 'template3a': {
- 'label': 'Template 4'
- }
- }
- },
- 'templates4': {
- 'label': 'Templates4',
- 'children': {
- 'template4a': {
- 'label': 'Template 4'
- }
- }
- },
- 'templates5': {
- 'label': 'Templates5',
- 'children': {
- 'template5a': {
- 'label': 'Template 5'
- }
- }
- },
- 'templates6': {
- 'label': 'Templates6',
- 'children': {
- 'template6a': {
- 'label': 'Template 6'
- }
- }
- },
- 'templates7': {
- 'label': 'Templates7',
- 'children': {
- 'template7a': {
- 'label': 'Template 7'
- }
- }
- },
- 'templates8': {
- 'label': 'Templates8',
- 'children': {
- 'template8a': {
- 'label': 'Template 8'
- }
- }
- }
- },
- 'sticky': 'NSEW'
- }
- },
- 'right_pane': {
- 'type': 'Frame',
- 'rowconfigure': LAST_ROW,
- 'entry1': {
- 'type': 'Entry',
- 'label': ' Label 1 ',
- 'label_anchor': 'w'
- },
- 'sep1': {
- 'type': 'Separator',
- 'row': 1,
- 'columnspan': LAST_COLUMN,
- 'orient': 'horizontal',
- 'sticky': 'EW'
- },
- 'entry2': {
- 'type': 'Entry',
- 'row': 2,
- 'label': ' Label 2 ',
- 'label_anchor': 'w'
- },
- 'load_defaults': {
- 'type': 'Checkbutton',
- 'row': 3,
- 'label': 'Load Defaults',
- 'value': 1,
- 'sticky': 'nw'
- },
- 'create_process1': {
- 'type': 'Button',
- 'row': 4,
- 'padx': [0, 5],
- 'text': 'Create Process1',
- 'sticky': 'W'
- },
- 'create_process2': {
- 'type': 'Button',
- 'row': 5,
- 'padx': [0, 5],
- 'text': 'Create Process2',
- 'sticky': 'W'
- },
- }
- }
- },
- 'window3': {
- 'type': 'Frame',
- 'window_title': 'Demo App3',
- 'auto_save': True,
- 'auto_start': False,
- 'scrollbars': False,
- 'save_geometry': True,
- 'sticky': 'nsew',
- 'content': {
- 'type': 'PanedWindow',
- 'orient': 'horizontal',
- 'sashwidth': 2,
- 'background': '#000000',
- 'sticky': 'nsew',
- 'left_pane': {
- 'type': 'Frame',
- 'treeview': {
- 'type': 'Treeview',
- 'rowspan': 9899,
- 'column': 0,
- 'label': 'Pages',
- 'scrollbars': 'vertical',
- 'items': {
- 'demos': {
- 'label': 'Demos',
- 'children': {
- '3d_demo': {
- 'label': '3D Demo'
- },
- 'animation_demo': {
- 'label': 'Animation Demo'
- },
- 'animation_demo_two': {
- 'label': 'Animation Demo Two'
- }
- }
- },
- 'statistics': {
- 'label': 'Statistics',
- 'children': {
- 'season_win_loss': {
- 'label': 'Season Win\\Loss'
- },
- 'season_game_times': {
- 'label': 'Season Game Times'
- }
- }
- },
- 'templates': {
- 'label': 'Templates',
- 'children': {
- 'template1': {
- 'label': 'Template 1'
- },
- 'template2': {
- 'label': 'Template 2'
- },
- 'template3': {
- 'label': 'Template 3'
- }
- }
- },
- 'templates1': {
- 'label': 'Templates1',
- 'children': {
- 'template1a': {
- 'label': 'Template 1'
- }
- }
- },
- 'templates2': {
- 'label': 'Templates2',
- 'children': {
- 'template2a': {
- 'label': 'Template 2'
- }
- }
- },
- 'templates3': {
- 'label': 'Templates3',
- 'children': {
- 'template3a': {
- 'label': 'Template 4'
- }
- }
- },
- 'templates4': {
- 'label': 'Templates4',
- 'children': {
- 'template4a': {
- 'label': 'Template 4'
- }
- }
- },
- 'templates5': {
- 'label': 'Templates5',
- 'children': {
- 'template5a': {
- 'label': 'Template 5'
- }
- }
- },
- 'templates6': {
- 'label': 'Templates6',
- 'children': {
- 'template6a': {
- 'label': 'Template 6'
- }
- }
- },
- 'templates7': {
- 'label': 'Templates7',
- 'children': {
- 'template7a': {
- 'label': 'Template 7'
- }
- }
- },
- 'templates8': {
- 'label': 'Templates8',
- 'children': {
- 'template8a': {
- 'label': 'Template 8'
- }
- }
- }
- },
- 'sticky': 'NSEW'
- }
- },
- 'right_pane': {
- 'type': 'Frame',
- 'rowconfigure': 2,
- 'entry1': {
- 'type': 'Entry',
- 'label': ' Label 1 ',
- 'label_anchor': 'w'
- },
- 'sep1': {
- 'type': 'Separator',
- 'row': 1,
- 'columnspan': LAST_COLUMN,
- 'orient': 'horizontal',
- 'sticky': 'EW'
- },
- 'entry2': {
- 'type': 'Entry',
- 'row': 2,
- 'label': ' Label 2 ',
- 'label_anchor': 'w'
- },
- 'load_defaults': {
- 'type': 'Checkbutton',
- 'row': LAST_ROW,
- 'label': 'Load Defaults',
- 'value': 1,
- },
- }
- }
- },
- 'window4': {
- 'type': 'Frame',
- 'window_title': 'Demo App4',
- 'auto_save': True,
- 'auto_start': False,
- 'scrollbars': False,
- 'save_geometry': True,
- 'sticky': 'nsew',
- 'content': {
- 'type': 'PanedWindow',
- 'orient': 'horizontal',
- 'sashwidth': 2,
- 'background': '#000000',
- 'sticky': 'nsew',
- 'left_pane': {
- 'type': 'Frame',
- 'treeview': {
- 'type': 'Treeview',
- 'rowspan': 9899,
- 'column': 0,
- 'label': 'Pages',
- 'scrollbars': 'vertical',
- 'items': {
- 'demos': {
- 'label': 'Demos',
- 'children': {
- '3d_demo': {
- 'label': '3D Demo'
- },
- 'animation_demo': {
- 'label': 'Animation Demo'
- },
- 'animation_demo_two': {
- 'label': 'Animation Demo Two'
- }
- }
- },
- 'statistics': {
- 'label': 'Statistics',
- 'children': {
- 'season_win_loss': {
- 'label': 'Season Win\\Loss'
- },
- 'season_game_times': {
- 'label': 'Season Game Times'
- }
- }
- },
- 'templates': {
- 'label': 'Templates',
- 'children': {
- 'template1': {
- 'label': 'Template 1'
- },
- 'template2': {
- 'label': 'Template 2'
- },
- 'template3': {
- 'label': 'Template 3'
- }
- }
- },
- 'templates1': {
- 'label': 'Templates1',
- 'children': {
- 'template1a': {
- 'label': 'Template 1'
- }
- }
- },
- 'templates2': {
- 'label': 'Templates2',
- 'children': {
- 'template2a': {
- 'label': 'Template 2'
- }
- }
- },
- 'templates3': {
- 'label': 'Templates3',
- 'children': {
- 'template3a': {
- 'label': 'Template 4'
- }
- }
- },
- 'templates4': {
- 'label': 'Templates4',
- 'children': {
- 'template4a': {
- 'label': 'Template 4'
- }
- }
- },
- 'templates5': {
- 'label': 'Templates5',
- 'children': {
- 'template5a': {
- 'label': 'Template 5'
- }
- }
- },
- 'templates6': {
- 'label': 'Templates6',
- 'children': {
- 'template6a': {
- 'label': 'Template 6'
- }
- }
- },
- 'templates7': {
- 'label': 'Templates7',
- 'children': {
- 'template7a': {
- 'label': 'Template 7'
- }
- }
- },
- 'templates8': {
- 'label': 'Templates8',
- 'children': {
- 'template8a': {
- 'label': 'Template 8'
- }
- }
- }
- },
- 'sticky': 'NSEW'
- }
- },
- 'right_pane': {
- 'type': 'Frame',
- 'rowconfigure': 2,
- 'entry1': {
- 'type': 'Entry',
- 'label': ' Label 1 ',
- 'label_anchor': 'w'
- },
- 'sep1': {
- 'type': 'Separator',
- 'row': 1,
- 'columnspan': LAST_COLUMN,
- 'orient': 'horizontal',
- 'sticky': 'EW'
- },
- 'entry2': {
- 'type': 'Entry',
- 'row': 2,
- 'label': ' Label 2 ',
- 'label_anchor': 'w'
- },
- 'load_defaults': {
- 'type': 'Checkbutton',
- 'row': LAST_ROW,
- 'label': 'Load Defaults',
- 'value': 1,
- },
- }
- }
- }
- }
- app = App(
- title='Demo Application',
- admin_open=True,
- admin_close=False,
- defaults=defaults
- )
- def progress_bar1(window):
- win = app.get_window(window.id)
- pb = win.get('content/middle_pane/progress/bar').progressbar
- def animate():
- pb.count += 500
- pb['value'] = pb.count
- if pb.count < pb['maximum']:
- pb.after(pb.refresh_rate, animate)
- else:
- messagebox.showinfo('Info', 'Process Completed Successfully')
- win.get('content/middle_pane/progress/start').button.config(command=animate)
- def progress_bar2(window):
- win = app.get_window(window.id)
- pb = win.get('content/middle_pane/notebook').tab('one').get('progress/bar').progressbar
- scale = win.get('content/middle_pane/notebook').tab('one').get('scale').scale
- def animate(count=None):
- if count:
- pb.count = 0
- pb.count += 500
- pb['value'] = pb.count
- if pb.count < pb['maximum']:
- pb.after(int(scale.get()), animate)
- else:
- messagebox.showinfo('Info', 'Process Completed Successfully')
- win.get('content/middle_pane/notebook').tab('one').get('progress/start').button.config(command=lambda: animate(1))
- def create_process1(window):
- win = app.get_window(window.id)
- def message():
- messagebox.showinfo('Info', 'This is process 1 ' + window.id)
- win.get('content/right_pane/create_process1').button.config(command=message)
- def create_process2(window):
- win = app.get_window(window.id)
- def message():
- messagebox.showinfo('Info', 'This is process 2 ' + window.id)
- win.get('content/right_pane/create_process2').button.config(command=message)
- def setup_process1(window):
- messagebox.showinfo('Info', 'before_open hook.')
- def setup_process2(window):
- messagebox.showinfo('Info', 'after_open hook.')
- def destroy_process1():
- messagebox.showinfo('Info', 'before_close hook.')
- def destroy_process2():
- messagebox.showinfo('Info', 'after_close hook.')
- def update_scale(window, val=None):
- tab = window.get('content/middle_pane/notebook').tab('one')
- label = tab.get('lscale')
- scale = tab.get('scale').scale
- if val is not None:
- label.var.set(int(float(val)))
- else:
- label.var.set(int(scale.get()))
- def refresh_scale(window):
- def scale(value):
- update_scale(window, value)
- window.get('content/middle_pane/notebook').tab('one').get('scale').scale.config(command=scale)
- app.register_callback('window1', 'after_open', progress_bar1)
- app.register_callback('window1', 'after_open', progress_bar2)
- app.register_callback('window1', 'after_open', update_scale)
- app.register_callback('window1', 'after_open', refresh_scale)
- app.register_callback('window2', 'after_open', create_process1)
- app.register_callback('window2', 'after_open', create_process2)
- app.remove_callback('window2', 'after_open', create_process1)
- app.register_callback('window2', 'after_open', setup_process2)
- app.register_callback('window2', 'before_open', setup_process1)
- app.register_callback('window2', 'before_close', destroy_process1)
- app.register_callback('window2', 'after_close', destroy_process2)
- app.init_windows().mainloop()
- if __name__ == '__main__':
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement