Advertisement
Uno-Dan

Untitled

Nov 5th, 2018
234
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 53.90 KB | None | 0 0
  1.  
  2. from tkinter import messagebox
  3.  
  4. from tkapp.base import App
  5. from tkapp.constants import LAST_ROW, LAST_COLUMN
  6.  
  7.  
  8. def main():
  9.     defaults = {
  10.         'window1': {
  11.             'type': 'Frame',
  12.             'window_title': 'Demo App1',
  13.             'auto_save': True,
  14.             'auto_start': False,
  15.             'scrollbars': False,
  16.             'save_geometry': True,
  17.             'sticky': 'nsew',
  18.             'content': {
  19.                 'type': 'PanedWindow',
  20.                 'orient': 'horizontal',
  21.                 'sashwidth': 2,
  22.                 'background': '#000000',
  23.                 'sticky': 'nsew',
  24.                 'left_pane': {
  25.                     'type': 'Frame',
  26.                     'treeview': {
  27.                         'type': 'Treeview',
  28.                         'rowspan': 9899,
  29.                         'column': 0,
  30.                         'label': 'Pages',
  31.                         'scrollbars': 'vertical',
  32.                         'items': {
  33.                             'demos': {
  34.                                 'label': 'Demos',
  35.                                 'children': {
  36.                                     '3d_demo': {
  37.                                         'label': '3D Demo'
  38.                                     },
  39.                                     'animation_demo': {
  40.                                         'label': 'Animation Demo'
  41.                                     },
  42.                                     'animation_demo_two': {
  43.                                         'label': 'Animation Demo Two'
  44.                                     }
  45.                                 }
  46.                             },
  47.                             'statistics': {
  48.                                 'label': 'Statistics',
  49.                                 'children': {
  50.                                     'season_win_loss': {
  51.                                         'label': 'Season Win\\Loss'
  52.                                     },
  53.                                     'season_game_times': {
  54.                                         'label': 'Season Game Times'
  55.                                     }
  56.                                 }
  57.                             },
  58.                             'templates': {
  59.                                 'label': 'Templates',
  60.                                 'children': {
  61.                                     'template1': {
  62.                                         'label': 'Template 1'
  63.                                     },
  64.                                     'template2': {
  65.                                         'label': 'Template 2'
  66.                                     },
  67.                                     'template3': {
  68.                                         'label': 'Template 3'
  69.                                     }
  70.                                 }
  71.                             },
  72.                         },
  73.                         'sticky': 'NSEW'
  74.                     }
  75.                 },
  76.                 'middle_pane': {
  77.                     'type': 'Frame',
  78.                     'rowconfigure': LAST_ROW,
  79.                     'entry1': {
  80.                         'type': 'Entry',
  81.                         'label': ' Label 1 ',
  82.                         'label_anchor': 'w'
  83.                     },
  84.                     'load_defaults': {
  85.                         'type': 'Checkbutton',
  86.                         'row': 3,
  87.                         'label': 'Load Defaults',
  88.                         'value': 1,
  89.                     },
  90.                     'radio_buttons': {
  91.                         'type': 'Radiobutton',
  92.                         'row': 4,
  93.                         'value': 1,
  94.                         'items': ('Button1', 'Button2')
  95.                     },
  96.                     'combobox': {
  97.                         'type': 'Combobox',
  98.                         'row': 5,
  99.                         'items': ('', 'Your Item1', 'Your Item2')
  100.                     },
  101.                     'spinbox': {
  102.                         'row': 6,
  103.                         'column': 0,
  104.                         'columnspan': 9900,
  105.                         'pady': 5,
  106.                         'type': 'Spinbox',
  107.                         'label': 'Spinbox',
  108.                         'label_anchor': 'w',
  109.                         'to': 10,
  110.                         'from_': 0,
  111.                         'value': '7',
  112.                         'wrap': True,
  113.                         'sticky': 'w',
  114.                     },
  115.                     'progress': {
  116.                         'type': 'Frame',
  117.                         'row': 7,
  118.                         'padx': 5,
  119.                         'pady': 5,
  120.                         'sticky': 'w',
  121.                         'columnconfigure': 1,
  122.                         'start': {
  123.                             'type': 'Button',
  124.                             'padx': [0, 5],
  125.                             'text': 'Start Process',
  126.                             'sticky': 'W'
  127.                         },
  128.                         'bar': {
  129.                             'type': 'Progressbar',
  130.                             'column': 1,
  131.                             'sticky': 'EW'
  132.                         }
  133.                     },
  134.                     'sep1': {
  135.                         'type': 'Separator',
  136.                         'row': 8,
  137.                         'pady': 5,
  138.                         'columnspan': LAST_COLUMN,
  139.                         'orient': 'horizontal',
  140.                         'sticky': 'EW'
  141.                     },
  142.                     'notebook': {
  143.                         'type': 'Notebook',
  144.                         'row': 9,
  145.                         'sticky': 'NW',
  146.                         'items': {
  147.                             'one': {
  148.                                 'label': 'One',
  149.                                 'content': {
  150.                                     'type': 'Frame',
  151.                                     'sticky': 'NEW',
  152.                                     'wrap': {
  153.                                         'type': 'LabelFrame',
  154.                                         'label': 'Group Title',
  155.                                         'sticky': 'NEW',
  156.                                         'padx': 5,
  157.                                         'pady': 5,
  158.                                         'ipadx': 5,
  159.                                         'ipady': 5,
  160.                                         'entry': {
  161.                                             'type': 'Entry',
  162.                                             'columnspan': 9900,
  163.                                             'label': 'Entry Label 3',
  164.                                             'label_width': 12,
  165.                                             'label_anchor': 'e',
  166.                                             'value': 'My Entry Text'
  167.                                         },
  168.                                         'quantity': {
  169.                                             'type': 'Combobox',
  170.                                             'row': 1,
  171.                                             'columnspan': 9900,
  172.                                             'pady': [
  173.                                                 5,
  174.                                                 0
  175.                                             ],
  176.                                             'label': 'Quantity',
  177.                                             'label_width': 12,
  178.                                             'label_anchor': 'e',
  179.                                             'items': [
  180.                                                 'One',
  181.                                                 'Two',
  182.                                                 'Three',
  183.                                                 'Four',
  184.                                                 'Five'
  185.                                             ],
  186.                                             'value': 1
  187.                                         },
  188.                                         'spinbox': {
  189.                                             'row': 2,
  190.                                             'column': 0,
  191.                                             'columnspan': 9900,
  192.                                             'pady': 5,
  193.                                             'type': 'Spinbox',
  194.                                             'label': 'Spinbox',
  195.                                             'label_width': 12,
  196.                                             'label_anchor': 'e',
  197.                                             'to': 10,
  198.                                             'from_': 0,
  199.                                             'value': '7',
  200.                                             'wrap': True
  201.                                         },
  202.                                         'sep1': {
  203.                                             'type': 'Separator',
  204.                                             'row': 3,
  205.                                             'pady': [
  206.                                                 5,
  207.                                                 0
  208.                                             ],
  209.                                             'columnspan': 9900,
  210.                                             'orient': 'horizontal',
  211.                                             'columnconfigure': 1,
  212.                                             'sticky': 'EW'
  213.                                         },
  214.                                         'checkbutton': {
  215.                                             'type': 'Checkbutton',
  216.                                             'row': 4,
  217.                                             'label': 'Check Me',
  218.                                             'label_width': 12,
  219.                                             'label_anchor': 'e',
  220.                                             'value': 0,
  221.                                             'onvalue': 1,
  222.                                             'highlightthickness': 0
  223.                                         },
  224.                                         'sep2': {
  225.                                             'type': 'Separator',
  226.                                             'row': 4,
  227.                                             'column': 1,
  228.                                             'orient': 'vertical',
  229.                                             'sticky': 'NS'
  230.                                         },
  231.                                         'radiobutton': {
  232.                                             'type': 'Radiobutton',
  233.                                             'row': 4,
  234.                                             'column': 2,
  235.                                             'items': [
  236.                                                 'one',
  237.                                                 'two',
  238.                                                 'three'
  239.                                             ],
  240.                                             'value': 0,
  241.                                             'sticky': 'w'
  242.                                         }
  243.                                     },
  244.                                     'progress': {
  245.                                         'type': 'Frame',
  246.                                         'row': 2,
  247.                                         'padx': 5,
  248.                                         'pady': 5,
  249.                                         'columnconfigure': 1,
  250.                                         'start': {
  251.                                             'type': 'Button',
  252.                                             'padx': [
  253.                                                 0,
  254.                                                 5
  255.                                             ],
  256.                                             'text': 'Start Process',
  257.                                             'sticky': 'W'
  258.                                         },
  259.                                         'bar': {
  260.                                             'type': 'Progressbar',
  261.                                             'column': 1,
  262.                                             'sticky': 'EW'
  263.                                         }
  264.                                     },
  265.                                     'label': {
  266.                                         'type': 'Label',
  267.                                         'row': 3,
  268.                                         'value': 99,
  269.                                         'sticky': 'EW'
  270.                                     },
  271.                                     'scale': {
  272.                                         'type': 'Scale',
  273.                                         'row': 4,
  274.                                         'padx': [
  275.                                             5,
  276.                                             0
  277.                                         ],
  278.                                         'to': 100,
  279.                                         'from_': 0,
  280.                                         'length': 298,
  281.                                         'value': 51
  282.                                     }
  283.                                 }
  284.                             },
  285.                             'two': {
  286.                                 'label': 'Two',
  287.                                 'content': {
  288.                                     'type': 'LabelFrame',
  289.                                     'label': 'Group Title',
  290.                                     'padx': 5,
  291.                                     'pady': 5,
  292.                                     'ipadx': 5,
  293.                                     'ipady': 5,
  294.                                     'sticky': 'NEW',
  295.                                     'columnconfigure': 1,
  296.                                     'entry': {
  297.                                         'type': 'Entry',
  298.                                         'columnspan': 9900,
  299.                                         'label': 'Entry Label 3',
  300.                                         'label_anchor': 'e',
  301.                                         'value': 'My Entry Text'
  302.                                     },
  303.                                     'spinbox': {
  304.                                         'row': 2,
  305.                                         'column': 0,
  306.                                         'columnspan': 9900,
  307.                                         'pady': 5,
  308.                                         'type': 'Spinbox',
  309.                                         'label': 'Spinbox',
  310.                                         'label_anchor': 'e',
  311.                                         'to': 10,
  312.                                         'from_': 0,
  313.                                         'value': '7',
  314.                                         'wrap': True
  315.                                     },
  316.                                     'checkbutton': {
  317.                                         'type': 'Checkbutton',
  318.                                         'row': 3,
  319.                                         'label': 'Check Me',
  320.                                         'label_anchor': 'e',
  321.                                         'value': 0,
  322.                                         'onvalue': 1
  323.                                     },
  324.                                     'sep1': {
  325.                                         'type': 'Separator',
  326.                                         'row': 3,
  327.                                         'column': 1,
  328.                                         'orient': 'vertical',
  329.                                         'sticky': 'NS'
  330.                                     },
  331.                                     'radiobutton': {
  332.                                         'type': 'Radiobutton',
  333.                                         'row': 3,
  334.                                         'column': 2,
  335.                                         'items': [
  336.                                             'one',
  337.                                             'two',
  338.                                             'three'
  339.                                         ],
  340.                                         'value': 0,
  341.                                         'sticky': 'w'
  342.                                     },
  343.                                     'sep2': {
  344.                                         'type': 'Separator',
  345.                                         'row': 4,
  346.                                         'pady': [
  347.                                             5,
  348.                                             0
  349.                                         ],
  350.                                         'columnspan': 9900,
  351.                                         'orient': 'horizontal',
  352.                                         'columnconfigure': 1,
  353.                                         'sticky': 'EW'
  354.                                     },
  355.                                     'tabs': {
  356.                                         'row': 5,
  357.                                         'column': 0,
  358.                                         'columnspan': 9900,
  359.                                         'pady': [
  360.                                             5,
  361.                                             0
  362.                                         ],
  363.                                         'type': 'Notebook',
  364.                                         'sticky': 'NSEW',
  365.                                         'items': {
  366.                                             'one': {
  367.                                                 'label': 'Tab1',
  368.                                                 'content': {
  369.                                                     'type': 'LabelFrame',
  370.                                                     'label': 'Group Title',
  371.                                                     'padx': 5,
  372.                                                     'pady': 5,
  373.                                                     'ipadx': 5,
  374.                                                     'ipady': 5,
  375.                                                     'sticky': 'NSEW',
  376.                                                     'columnconfigure': 1,
  377.                                                     'entry': {
  378.                                                         'type': 'Entry',
  379.                                                         'columnspan': 9900,
  380.                                                         'label': 'Entry Label 3',
  381.                                                         'label_width': 12,
  382.                                                         'label_anchor': 'e',
  383.                                                         'value': 'My Entry Text'
  384.                                                     },
  385.                                                     'spinbox': {
  386.                                                         'row': 2,
  387.                                                         'column': 0,
  388.                                                         'columnspan': 9900,
  389.                                                         'pady': 5,
  390.                                                         'type': 'Spinbox',
  391.                                                         'label': 'Spinbox',
  392.                                                         'label_width': 12,
  393.                                                         'label_anchor': 'e',
  394.                                                         'to': 10,
  395.                                                         'from_': 0,
  396.                                                         'value': '7',
  397.                                                         'wrap': True
  398.                                                     },
  399.                                                     'checkbutton': {
  400.                                                         'type': 'Checkbutton',
  401.                                                         'row': 3,
  402.                                                         'label': 'Check Me',
  403.                                                         'label_width': 12,
  404.                                                         'label_anchor': 'e',
  405.                                                         'value': 0,
  406.                                                         'onvalue': 1
  407.                                                     },
  408.                                                     'sep1': {
  409.                                                         'type': 'Separator',
  410.                                                         'row': 3,
  411.                                                         'column': 1,
  412.                                                         'orient': 'vertical',
  413.                                                         'sticky': 'NS'
  414.                                                     },
  415.                                                     'radiobutton': {
  416.                                                         'type': 'Radiobutton',
  417.                                                         'row': 3,
  418.                                                         'column': 2,
  419.                                                         'items': [
  420.                                                             'one',
  421.                                                             'two',
  422.                                                             'three'
  423.                                                         ],
  424.                                                         'value': 0,
  425.                                                         'sticky': 'w'
  426.                                                     }
  427.                                                 }
  428.                                             },
  429.                                             'two': {
  430.                                                 'label': 'Tab2',
  431.                                                 'content': {
  432.                                                     'type': 'LabelFrame',
  433.                                                     'label': 'Group Title',
  434.                                                     'padx': 5,
  435.                                                     'pady': 5,
  436.                                                     'ipadx': 5,
  437.                                                     'ipady': 5,
  438.                                                     'sticky': 'NSEW',
  439.                                                     'entry': {
  440.                                                         'type': 'Entry',
  441.                                                         'columnspan': 9900,
  442.                                                         'label': 'Entry Label 3',
  443.                                                         'label_width': 12,
  444.                                                         'label_anchor': 'e',
  445.                                                         'value': 'My Entry Text'
  446.                                                     },
  447.                                                     'spinbox': {
  448.                                                         'row': 2,
  449.                                                         'column': 0,
  450.                                                         'columnspan': 9900,
  451.                                                         'pady': 5,
  452.                                                         'type': 'Spinbox',
  453.                                                         'label': 'Spinbox',
  454.                                                         'label_width': 12,
  455.                                                         'label_anchor': 'e',
  456.                                                         'to': 10,
  457.                                                         'from_': 0,
  458.                                                         'value': '7',
  459.                                                         'wrap': True
  460.                                                     },
  461.                                                     'checkbutton': {
  462.                                                         'type': 'Checkbutton',
  463.                                                         'row': 3,
  464.                                                         'label': 'Check Me',
  465.                                                         'label_width': 12,
  466.                                                         'label_anchor': 'e',
  467.                                                         'value': 0,
  468.                                                         'onvalue': 1
  469.                                                     },
  470.                                                     'sep1': {
  471.                                                         'type': 'Separator',
  472.                                                         'row': 3,
  473.                                                         'column': 1,
  474.                                                         'orient': 'vertical',
  475.                                                         'sticky': 'NS'
  476.                                                     },
  477.                                                     'radiobutton': {
  478.                                                         'type': 'Radiobutton',
  479.                                                         'row': 3,
  480.                                                         'column': 2,
  481.                                                         'items': [
  482.                                                             'one',
  483.                                                             'two',
  484.                                                             'three'
  485.                                                         ],
  486.                                                         'value': 0,
  487.                                                         'sticky': 'w'
  488.                                                     }
  489.                                                 }
  490.                                             },
  491.                                             'three': {
  492.                                                 'label': 'Tab3',
  493.                                                 'content': {
  494.                                                     'type': 'LabelFrame',
  495.                                                     'label': 'Group Title',
  496.                                                     'padx': 5,
  497.                                                     'pady': 5,
  498.                                                     'ipadx': 5,
  499.                                                     'ipady': 5,
  500.                                                     'sticky': 'NSEW',
  501.                                                     'entry': {
  502.                                                         'type': 'Entry',
  503.                                                         'columnspan': 9900,
  504.                                                         'label': 'Entry Label 3',
  505.                                                         'label_width': 12,
  506.                                                         'label_anchor': 'e',
  507.                                                         'value': 'Some more Text'
  508.                                                     },
  509.                                                     'spinbox': {
  510.                                                         'row': 2,
  511.                                                         'column': 0,
  512.                                                         'columnspan': 9900,
  513.                                                         'pady': 5,
  514.                                                         'type': 'Spinbox',
  515.                                                         'label': 'Spinbox',
  516.                                                         'label_width': 12,
  517.                                                         'label_anchor': 'e',
  518.                                                         'to': 10,
  519.                                                         'from_': 0,
  520.                                                         'value': '8',
  521.                                                         'wrap': True
  522.                                                     },
  523.                                                     'sep1': {
  524.                                                         'type': 'Separator',
  525.                                                         'row': 3,
  526.                                                         'pady': [
  527.                                                             5,
  528.                                                             0
  529.                                                         ],
  530.                                                         'columnspan': 9900,
  531.                                                         'orient': 'horizontal',
  532.                                                         'columnconfigure': 1,
  533.                                                         'sticky': 'EW'
  534.                                                     },
  535.                                                     'checkbutton': {
  536.                                                         'type': 'Checkbutton',
  537.                                                         'row': 4,
  538.                                                         'label': 'Check Me',
  539.                                                         'label_width': 12,
  540.                                                         'label_anchor': 'e',
  541.                                                         'value': 0,
  542.                                                         'onvalue': 1
  543.                                                     },
  544.                                                     'radiobutton': {
  545.                                                         'type': 'Radiobutton',
  546.                                                         'row': 4,
  547.                                                         'column': 2,
  548.                                                         'items': [
  549.                                                             'one',
  550.                                                             'two',
  551.                                                             'three'
  552.                                                         ],
  553.                                                         'value': 0,
  554.                                                         'sticky': 'w'
  555.                                                     }
  556.                                                 }
  557.                                             }
  558.                                         }
  559.                                     }
  560.                                 }
  561.                             }
  562.                         }
  563.                     },
  564.                 },
  565.             }
  566.         },
  567.         'window2': {
  568.             'type': 'Frame',
  569.             'window_title': 'Demo App2',
  570.             'auto_save': True,
  571.             'auto_start': False,
  572.             'scrollbars': False,
  573.             'save_geometry': True,
  574.             'sticky': 'nsew',
  575.             'content': {
  576.                 'type': 'PanedWindow',
  577.                 'orient': 'horizontal',
  578.                 'sashwidth': 2,
  579.                 'background': '#000000',
  580.                 'sticky': 'nsew',
  581.                 'left_pane': {
  582.                     'type': 'Frame',
  583.                     'treeview': {
  584.                         'type': 'Treeview',
  585.                         'rowspan': 9899,
  586.                         'column': 0,
  587.                         'label': 'Pages',
  588.                         'scrollbars': 'vertical',
  589.                         'items': {
  590.                             'demos': {
  591.                                 'label': 'Demos',
  592.                                 'children': {
  593.                                     '3d_demo': {
  594.                                         'label': '3D Demo'
  595.                                     },
  596.                                     'animation_demo': {
  597.                                         'label': 'Animation Demo'
  598.                                     },
  599.                                     'animation_demo_two': {
  600.                                         'label': 'Animation Demo Two'
  601.                                     }
  602.                                 }
  603.                             },
  604.                             'statistics': {
  605.                                 'label': 'Statistics',
  606.                                 'children': {
  607.                                     'season_win_loss': {
  608.                                         'label': 'Season Win\\Loss'
  609.                                     },
  610.                                     'season_game_times': {
  611.                                         'label': 'Season Game Times 12345678901234567890'
  612.                                     }
  613.                                 }
  614.                             },
  615.                             'templates': {
  616.                                 'label': 'Templates',
  617.                                 'children': {
  618.                                     'template1': {
  619.                                         'label': 'Template 1'
  620.                                     },
  621.                                     'template2': {
  622.                                         'label': 'Template 2'
  623.                                     },
  624.                                     'template3': {
  625.                                         'label': 'Template 3'
  626.                                     }
  627.                                 }
  628.                             },
  629.                             'templates1': {
  630.                                 'label': 'Templates1',
  631.                                 'children': {
  632.                                     'template1a': {
  633.                                         'label': 'Template 1'
  634.                                     }
  635.                                 }
  636.                             },
  637.                             'templates2': {
  638.                                 'label': 'Templates2',
  639.                                 'children': {
  640.                                     'template2a': {
  641.                                         'label': 'Template 2'
  642.                                     }
  643.                                 }
  644.                             },
  645.                             'templates3': {
  646.                                 'label': 'Templates3',
  647.                                 'children': {
  648.                                     'template3a': {
  649.                                         'label': 'Template 4'
  650.                                     }
  651.                                 }
  652.                             },
  653.                             'templates4': {
  654.                                 'label': 'Templates4',
  655.                                 'children': {
  656.                                     'template4a': {
  657.                                         'label': 'Template 4'
  658.                                     }
  659.                                 }
  660.                             },
  661.                             'templates5': {
  662.                                 'label': 'Templates5',
  663.                                 'children': {
  664.                                     'template5a': {
  665.                                         'label': 'Template 5'
  666.                                     }
  667.                                 }
  668.                             },
  669.                             'templates6': {
  670.                                 'label': 'Templates6',
  671.                                 'children': {
  672.                                     'template6a': {
  673.                                         'label': 'Template 6'
  674.                                     }
  675.                                 }
  676.                             },
  677.                             'templates7': {
  678.                                 'label': 'Templates7',
  679.                                 'children': {
  680.                                     'template7a': {
  681.                                         'label': 'Template 7'
  682.                                     }
  683.                                 }
  684.                             },
  685.                             'templates8': {
  686.                                 'label': 'Templates8',
  687.                                 'children': {
  688.                                     'template8a': {
  689.                                         'label': 'Template 8'
  690.                                     }
  691.                                 }
  692.                             }
  693.                         },
  694.                         'sticky': 'NSEW'
  695.                     }
  696.                 },
  697.                 'right_pane': {
  698.                     'type': 'Frame',
  699.                     'rowconfigure': LAST_ROW,
  700.                     'entry1': {
  701.                         'type': 'Entry',
  702.                         'label': ' Label 1 ',
  703.                         'label_anchor': 'w'
  704.                     },
  705.                     'sep1': {
  706.                         'type': 'Separator',
  707.                         'row': 1,
  708.                         'columnspan': LAST_COLUMN,
  709.                         'orient': 'horizontal',
  710.                         'sticky': 'EW'
  711.                     },
  712.                     'entry2': {
  713.                         'type': 'Entry',
  714.                         'row': 2,
  715.                         'label': ' Label 2 ',
  716.                         'label_anchor': 'w'
  717.                     },
  718.                     'load_defaults': {
  719.                         'type': 'Checkbutton',
  720.                         'row': 3,
  721.                         'label': 'Load Defaults',
  722.                         'value': 1,
  723.                         'sticky': 'nw'
  724.                     },
  725.                     'create_process1': {
  726.                         'type': 'Button',
  727.                         'row': 4,
  728.                         'padx': [0, 5],
  729.                         'text': 'Create Process1',
  730.                         'sticky': 'W'
  731.                     },
  732.                     'create_process2': {
  733.                         'type': 'Button',
  734.                         'row': 5,
  735.                         'padx': [0, 5],
  736.                         'text': 'Create Process2',
  737.                         'sticky': 'W'
  738.                     },
  739.                 }
  740.             }
  741.         },
  742.         'window3': {
  743.             'type': 'Frame',
  744.             'window_title': 'Demo App3',
  745.             'auto_save': True,
  746.             'auto_start': False,
  747.             'scrollbars': False,
  748.             'save_geometry': True,
  749.             'sticky': 'nsew',
  750.             'content': {
  751.                 'type': 'PanedWindow',
  752.                 'orient': 'horizontal',
  753.                 'sashwidth': 2,
  754.                 'background': '#000000',
  755.                 'sticky': 'nsew',
  756.                 'left_pane': {
  757.                     'type': 'Frame',
  758.                     'treeview': {
  759.                         'type': 'Treeview',
  760.                         'rowspan': 9899,
  761.                         'column': 0,
  762.                         'label': 'Pages',
  763.                         'scrollbars': 'vertical',
  764.                         'items': {
  765.                             'demos': {
  766.                                 'label': 'Demos',
  767.                                 'children': {
  768.                                     '3d_demo': {
  769.                                         'label': '3D Demo'
  770.                                     },
  771.                                     'animation_demo': {
  772.                                         'label': 'Animation Demo'
  773.                                     },
  774.                                     'animation_demo_two': {
  775.                                         'label': 'Animation Demo Two'
  776.                                     }
  777.                                 }
  778.                             },
  779.                             'statistics': {
  780.                                 'label': 'Statistics',
  781.                                 'children': {
  782.                                     'season_win_loss': {
  783.                                         'label': 'Season Win\\Loss'
  784.                                     },
  785.                                     'season_game_times': {
  786.                                         'label': 'Season Game Times 12345678901234567890'
  787.                                     }
  788.                                 }
  789.                             },
  790.                             'templates': {
  791.                                 'label': 'Templates',
  792.                                 'children': {
  793.                                     'template1': {
  794.                                         'label': 'Template 1'
  795.                                     },
  796.                                     'template2': {
  797.                                         'label': 'Template 2'
  798.                                     },
  799.                                     'template3': {
  800.                                         'label': 'Template 3'
  801.                                     }
  802.                                 }
  803.                             },
  804.                             'templates1': {
  805.                                 'label': 'Templates1',
  806.                                 'children': {
  807.                                     'template1a': {
  808.                                         'label': 'Template 1'
  809.                                     }
  810.                                 }
  811.                             },
  812.                             'templates2': {
  813.                                 'label': 'Templates2',
  814.                                 'children': {
  815.                                     'template2a': {
  816.                                         'label': 'Template 2'
  817.                                     }
  818.                                 }
  819.                             },
  820.                             'templates3': {
  821.                                 'label': 'Templates3',
  822.                                 'children': {
  823.                                     'template3a': {
  824.                                         'label': 'Template 4'
  825.                                     }
  826.                                 }
  827.                             },
  828.                             'templates4': {
  829.                                 'label': 'Templates4',
  830.                                 'children': {
  831.                                     'template4a': {
  832.                                         'label': 'Template 4'
  833.                                     }
  834.                                 }
  835.                             },
  836.                             'templates5': {
  837.                                 'label': 'Templates5',
  838.                                 'children': {
  839.                                     'template5a': {
  840.                                         'label': 'Template 5'
  841.                                     }
  842.                                 }
  843.                             },
  844.                             'templates6': {
  845.                                 'label': 'Templates6',
  846.                                 'children': {
  847.                                     'template6a': {
  848.                                         'label': 'Template 6'
  849.                                     }
  850.                                 }
  851.                             },
  852.                             'templates7': {
  853.                                 'label': 'Templates7',
  854.                                 'children': {
  855.                                     'template7a': {
  856.                                         'label': 'Template 7'
  857.                                     }
  858.                                 }
  859.                             },
  860.                             'templates8': {
  861.                                 'label': 'Templates8',
  862.                                 'children': {
  863.                                     'template8a': {
  864.                                         'label': 'Template 8'
  865.                                     }
  866.                                 }
  867.                             }
  868.                         },
  869.                         'sticky': 'NSEW'
  870.                     }
  871.                 },
  872.                 'right_pane': {
  873.                     'type': 'Frame',
  874.                     'rowconfigure': 2,
  875.                     'entry1': {
  876.                         'type': 'Entry',
  877.                         'label': ' Label 1 ',
  878.                         'label_anchor': 'w'
  879.                     },
  880.                     'sep1': {
  881.                         'type': 'Separator',
  882.                         'row': 1,
  883.                         'columnspan': LAST_COLUMN,
  884.                         'orient': 'horizontal',
  885.                         'sticky': 'EW'
  886.                     },
  887.                     'entry2': {
  888.                         'type': 'Entry',
  889.                         'row': 2,
  890.                         'label': ' Label 2 ',
  891.                         'label_anchor': 'w'
  892.                     },
  893.                     'load_defaults': {
  894.                         'type': 'Checkbutton',
  895.                         'row': LAST_ROW,
  896.                         'label': 'Load Defaults',
  897.                         'value': 1,
  898.                     },
  899.                 }
  900.             }
  901.         },
  902.         'window4': {
  903.             'type': 'Frame',
  904.             'window_title': 'Demo App4',
  905.             'auto_save': True,
  906.             'auto_start': False,
  907.             'scrollbars': False,
  908.             'save_geometry': True,
  909.             'sticky': 'nsew',
  910.             'content': {
  911.                 'type': 'PanedWindow',
  912.                 'orient': 'horizontal',
  913.                 'sashwidth': 2,
  914.                 'background': '#000000',
  915.                 'sticky': 'nsew',
  916.                 'left_pane': {
  917.                     'type': 'Frame',
  918.                     'treeview': {
  919.                         'type': 'Treeview',
  920.                         'rowspan': 9899,
  921.                         'column': 0,
  922.                         'label': 'Pages',
  923.                         'scrollbars': 'vertical',
  924.                         'items': {
  925.                             'demos': {
  926.                                 'label': 'Demos',
  927.                                 'children': {
  928.                                     '3d_demo': {
  929.                                         'label': '3D Demo'
  930.                                     },
  931.                                     'animation_demo': {
  932.                                         'label': 'Animation Demo'
  933.                                     },
  934.                                     'animation_demo_two': {
  935.                                         'label': 'Animation Demo Two'
  936.                                     }
  937.                                 }
  938.                             },
  939.                             'statistics': {
  940.                                 'label': 'Statistics',
  941.                                 'children': {
  942.                                     'season_win_loss': {
  943.                                         'label': 'Season Win\\Loss'
  944.                                     },
  945.                                     'season_game_times': {
  946.                                         'label': 'Season Game Times 12345678901234567890'
  947.                                     }
  948.                                 }
  949.                             },
  950.                             'templates': {
  951.                                 'label': 'Templates',
  952.                                 'children': {
  953.                                     'template1': {
  954.                                         'label': 'Template 1'
  955.                                     },
  956.                                     'template2': {
  957.                                         'label': 'Template 2'
  958.                                     },
  959.                                     'template3': {
  960.                                         'label': 'Template 3'
  961.                                     }
  962.                                 }
  963.                             },
  964.                             'templates1': {
  965.                                 'label': 'Templates1',
  966.                                 'children': {
  967.                                     'template1a': {
  968.                                         'label': 'Template 1'
  969.                                     }
  970.                                 }
  971.                             },
  972.                             'templates2': {
  973.                                 'label': 'Templates2',
  974.                                 'children': {
  975.                                     'template2a': {
  976.                                         'label': 'Template 2'
  977.                                     }
  978.                                 }
  979.                             },
  980.                             'templates3': {
  981.                                 'label': 'Templates3',
  982.                                 'children': {
  983.                                     'template3a': {
  984.                                         'label': 'Template 4'
  985.                                     }
  986.                                 }
  987.                             },
  988.                             'templates4': {
  989.                                 'label': 'Templates4',
  990.                                 'children': {
  991.                                     'template4a': {
  992.                                         'label': 'Template 4'
  993.                                     }
  994.                                 }
  995.                             },
  996.                             'templates5': {
  997.                                 'label': 'Templates5',
  998.                                 'children': {
  999.                                     'template5a': {
  1000.                                         'label': 'Template 5'
  1001.                                     }
  1002.                                 }
  1003.                             },
  1004.                             'templates6': {
  1005.                                 'label': 'Templates6',
  1006.                                 'children': {
  1007.                                     'template6a': {
  1008.                                         'label': 'Template 6'
  1009.                                     }
  1010.                                 }
  1011.                             },
  1012.                             'templates7': {
  1013.                                 'label': 'Templates7',
  1014.                                 'children': {
  1015.                                     'template7a': {
  1016.                                         'label': 'Template 7'
  1017.                                     }
  1018.                                 }
  1019.                             },
  1020.                             'templates8': {
  1021.                                 'label': 'Templates8',
  1022.                                 'children': {
  1023.                                     'template8a': {
  1024.                                         'label': 'Template 8'
  1025.                                     }
  1026.                                 }
  1027.                             }
  1028.                         },
  1029.                         'sticky': 'NSEW'
  1030.                     }
  1031.                 },
  1032.                 'right_pane': {
  1033.                     'type': 'Frame',
  1034.                     'rowconfigure': 2,
  1035.                     'entry1': {
  1036.                         'type': 'Entry',
  1037.                         'label': ' Label 1 ',
  1038.                         'label_anchor': 'w'
  1039.                     },
  1040.                     'sep1': {
  1041.                         'type': 'Separator',
  1042.                         'row': 1,
  1043.                         'columnspan': LAST_COLUMN,
  1044.                         'orient': 'horizontal',
  1045.                         'sticky': 'EW'
  1046.                     },
  1047.                     'entry2': {
  1048.                         'type': 'Entry',
  1049.                         'row': 2,
  1050.                         'label': ' Label 2 ',
  1051.                         'label_anchor': 'w'
  1052.                     },
  1053.                     'load_defaults': {
  1054.                         'type': 'Checkbutton',
  1055.                         'row': LAST_ROW,
  1056.                         'label': 'Load Defaults',
  1057.                         'value': 1,
  1058.                     },
  1059.                 }
  1060.             }
  1061.         }
  1062.     }
  1063.  
  1064.     app = App(
  1065.         title='Demo Application',
  1066.         admin_open=True,
  1067.         admin_close=False,
  1068.         defaults=defaults
  1069.     )
  1070.  
  1071.     def progress_bar(window):
  1072.         win = app.get_window(window.id)
  1073.         pb = win.get('content/middle_pane/progress/bar').progressbar
  1074.  
  1075.         pb.bytes = 0
  1076.         pb['value'] = 0
  1077.         pb['maximum'] = 50000
  1078.  
  1079.         def animate():
  1080.             pb.bytes += 500
  1081.             pb['value'] = pb.bytes
  1082.             if pb.bytes < pb['maximum']:
  1083.                 pb.after(50, animate)
  1084.             else:
  1085.                 messagebox.showinfo('Info', 'Process Completed Successfully')
  1086.  
  1087.         win.get('content/middle_pane/progress/start').button.config(command=animate)
  1088.  
  1089.     def setup_process1():
  1090.         messagebox.showinfo('Info', 'before_open hook.')
  1091.  
  1092.     def setup_process2(window):
  1093.         messagebox.showinfo('Info', 'after_open hook. ' + window.id)
  1094.  
  1095.     def create_process1(window):
  1096.         win = app.get_window(window.id)
  1097.  
  1098.         def message():
  1099.             messagebox.showinfo('Info', 'This is process 1 ' + window.id)
  1100.  
  1101.         win.get('content/right_pane/create_process1').button.config(command=message)
  1102.  
  1103.     def create_process2(window):
  1104.         win = app.get_window(window.id)
  1105.  
  1106.         def message():
  1107.             messagebox.showinfo('Info', 'This is process 2 ' + window.id)
  1108.  
  1109.         win.get('content/right_pane/create_process2').button.config(command=message)
  1110.  
  1111.     def destroy_process1():
  1112.         messagebox.showinfo('Info', 'before_close hook.')
  1113.  
  1114.     def destroy_process1a():
  1115.         messagebox.showinfo('Info', 'before_close2 hook.')
  1116.  
  1117.     def destroy_process2():
  1118.         messagebox.showinfo('Info', 'after_close hook.')
  1119.  
  1120.     app.register_callback('after_open', 'window1/progress_bar', progress_bar)
  1121.  
  1122.     app.register_callback('before_open', 'window2/setup_process1', setup_process1)
  1123.     app.register_callback('after_open', 'window2/setup_process2', setup_process2)
  1124.  
  1125.     app.register_callback('after_open', 'window2/create_process1', create_process1)
  1126.     app.register_callback('after_open', 'window2/create_process2', create_process2)
  1127.  
  1128.     app.register_callback('before_close', 'window2/destroy_process1', destroy_process1)
  1129.     app.register_callback('before_close', 'window2/destroy_process1a', destroy_process1a)
  1130.     app.register_callback('after_close', 'window2/destroy_process2', destroy_process2)
  1131.  
  1132.     app.init_windows()
  1133.  
  1134.     app.mainloop()
  1135.  
  1136.  
  1137. if __name__ == '__main__':
  1138.     main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement