Advertisement
gregwa

ttkdemo.py

Aug 26th, 2019
432
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 7.25 KB | None | 0 0
  1. #! /usr/bin/env python
  2. #  -*- coding: utf-8 -*-
  3. #
  4. # GUI module generated by PAGE version 4.25
  5. #  in conjunction with Tcl version 8.6
  6. #    Aug 26, 2019 05:43:13 AM CDT  platform: Linux
  7.  
  8. import sys
  9.  
  10. try:
  11.     import Tkinter as tk
  12. except ImportError:
  13.     import tkinter as tk
  14.  
  15. try:
  16.     import ttk
  17.     py3 = False
  18. except ImportError:
  19.     import tkinter.ttk as ttk
  20.     py3 = True
  21.  
  22. import ttkdemo_support
  23.  
  24. def vp_start_gui():
  25.     '''Starting point when module is the main routine.'''
  26.     global val, w, root
  27.     root = tk.Tk()
  28.     ttkdemo_support.set_Tk_var()
  29.     top = Toplevel1 (root)
  30.     ttkdemo_support.init(root, top)
  31.     root.mainloop()
  32.  
  33. w = None
  34. def create_Toplevel1(root, *args, **kwargs):
  35.     '''Starting point when module is imported by another program.'''
  36.     global w, w_win, rt
  37.     rt = root
  38.     w = tk.Toplevel (root)
  39.     ttkdemo_support.set_Tk_var()
  40.     top = Toplevel1 (w)
  41.     ttkdemo_support.init(w, top, *args, **kwargs)
  42.     return (w, top)
  43.  
  44. def destroy_Toplevel1():
  45.     global w
  46.     w.destroy()
  47.     w = None
  48.  
  49. class Toplevel1:
  50.     def __init__(self, top=None):
  51.         '''This class configures and populates the toplevel window.
  52.           top is the toplevel containing window.'''
  53.         _bgcolor = '#d9d9d9'  # X11 color: 'gray85'
  54.         _fgcolor = '#000000'  # X11 color: 'black'
  55.         _compcolor = '#d9d9d9' # X11 color: 'gray85'
  56.         _ana1color = '#d9d9d9' # X11 color: 'gray85'
  57.         _ana2color = '#ececec' # Closest X11 color: 'gray92'
  58.         self.style = ttk.Style()
  59.         if sys.platform == "win32":
  60.             self.style.theme_use('winnative')
  61.         self.style.configure('.',background=_bgcolor)
  62.         self.style.configure('.',foreground=_fgcolor)
  63.         self.style.configure('.',font="TkDefaultFont")
  64.         self.style.map('.',background=
  65.             [('selected', _compcolor), ('active',_ana2color)])
  66.  
  67.         top.geometry("516x450+262+131")
  68.         top.title("ttk Widget Demo")
  69.         top.configure(highlightcolor="black")
  70.  
  71.         self.TButton1 = ttk.Button(top)
  72.         self.TButton1.place(x=370, y=30,  height=28, width=83)
  73.         self.TButton1.configure(command=ttkdemo_support.on_btnExit)
  74.         self.TButton1.configure(takefocus="")
  75.         self.TButton1.configure(text='''Exit''')
  76.  
  77.         self.style.map('TCheckbutton',background=
  78.             [('selected', _bgcolor), ('active', _ana2color)])
  79.         self.TCheckbutton1 = ttk.Checkbutton(top)
  80.         self.TCheckbutton1.place(x=70, y=90, width=104, height=21)
  81.         self.TCheckbutton1.configure(variable=ttkdemo_support.tch46)
  82.         self.TCheckbutton1.configure(takefocus="")
  83.         self.TCheckbutton1.configure(text='''Tcheck''')
  84.  
  85.         self.TCombobox1 = ttk.Combobox(top)
  86.         self.TCombobox1.place(x=70, y=140, height=21, width=177)
  87.         self.TCombobox1.configure(textvariable=ttkdemo_support.combobox)
  88.         self.TCombobox1.configure(takefocus="")
  89.  
  90.         self.TLabelframe1 = ttk.Labelframe(top)
  91.         self.TLabelframe1.place(x=340, y=120, height=265, width=150)
  92.         self.TLabelframe1.configure(relief='')
  93.         self.TLabelframe1.configure(text='''Styles''')
  94.  
  95.         self.style.map('TRadiobutton',background=
  96.             [('selected', _bgcolor), ('active', _ana2color)])
  97.         self.TRadiobutton1 = ttk.Radiobutton(self.TLabelframe1)
  98.         self.TRadiobutton1.place(x=20, y=30, width=66, height=21
  99.                 , bordermode='ignore')
  100.         self.TRadiobutton1.configure(variable=ttkdemo_support.selectedButton)
  101.         self.TRadiobutton1.configure(value="0")
  102.         self.TRadiobutton1.configure(command=ttkdemo_support.on_rbClick)
  103.         self.TRadiobutton1.configure(text='''TRadio''')
  104.  
  105.         self.TRadiobutton2 = ttk.Radiobutton(self.TLabelframe1)
  106.         self.TRadiobutton2.place(x=20, y=60, width=66, height=21
  107.                 , bordermode='ignore')
  108.         self.TRadiobutton2.configure(variable=ttkdemo_support.selectedButton)
  109.         self.TRadiobutton2.configure(command=ttkdemo_support.on_rbClick)
  110.         self.TRadiobutton2.configure(text='''TRadio''')
  111.  
  112.         self.TRadiobutton3 = ttk.Radiobutton(self.TLabelframe1)
  113.         self.TRadiobutton3.place(x=20, y=90, width=66, height=21
  114.                 , bordermode='ignore')
  115.         self.TRadiobutton3.configure(variable=ttkdemo_support.selectedButton)
  116.         self.TRadiobutton3.configure(value="2")
  117.         self.TRadiobutton3.configure(command=ttkdemo_support.on_rbClick)
  118.         self.TRadiobutton3.configure(text='''TRadio''')
  119.  
  120.         self.TRadiobutton4 = ttk.Radiobutton(self.TLabelframe1)
  121.         self.TRadiobutton4.place(x=20, y=120, width=66, height=21
  122.                 , bordermode='ignore')
  123.         self.TRadiobutton4.configure(variable=ttkdemo_support.selectedButton)
  124.         self.TRadiobutton4.configure(value="3")
  125.         self.TRadiobutton4.configure(command=ttkdemo_support.on_rbClick)
  126.         self.TRadiobutton4.configure(text='''TRadio''')
  127.  
  128.         self.TRadiobutton5 = ttk.Radiobutton(self.TLabelframe1)
  129.         self.TRadiobutton5.place(x=20, y=150, width=66, height=21
  130.                 , bordermode='ignore')
  131.         self.TRadiobutton5.configure(variable=ttkdemo_support.selectedButton)
  132.         self.TRadiobutton5.configure(value="4")
  133.         self.TRadiobutton5.configure(command=ttkdemo_support.on_rbClick)
  134.         self.TRadiobutton5.configure(text='''TRadio''')
  135.  
  136.         self.TRadiobutton6 = ttk.Radiobutton(self.TLabelframe1)
  137.         self.TRadiobutton6.place(x=20, y=180, width=66, height=21
  138.                 , bordermode='ignore')
  139.         self.TRadiobutton6.configure(variable=ttkdemo_support.selectedButton)
  140.         self.TRadiobutton6.configure(value="5")
  141.         self.TRadiobutton6.configure(command=ttkdemo_support.on_rbClick)
  142.         self.TRadiobutton6.configure(text='''TRadio''')
  143.  
  144.         self.TRadiobutton7 = ttk.Radiobutton(self.TLabelframe1)
  145.         self.TRadiobutton7.place(x=20, y=210, width=66, height=21
  146.                 , bordermode='ignore')
  147.         self.TRadiobutton7.configure(variable=ttkdemo_support.selectedButton)
  148.         self.TRadiobutton7.configure(value="6")
  149.         self.TRadiobutton7.configure(command=ttkdemo_support.on_rbClick)
  150.         self.TRadiobutton7.configure(text='''TRadio''')
  151.  
  152.         self.TProgressbar1 = ttk.Progressbar(top)
  153.         self.TProgressbar1.place(x=70, y=200, width=100, height=19)
  154.         self.TProgressbar1.configure(mode="indeterminate")
  155.  
  156.         self.TEntry1 = ttk.Entry(top)
  157.         self.TEntry1.place(x=70, y=260, height=21, width=164)
  158.         self.TEntry1.configure(textvariable=ttkdemo_support.EntryVar)
  159.         self.TEntry1.configure(takefocus="")
  160.         self.TEntry1.configure(cursor="xterm")
  161.  
  162.         self.TLabel1 = ttk.Label(top)
  163.         self.TLabel1.place(x=70, y=330,  height=19, width=172)
  164.         self.TLabel1.configure(background="#d9d9d9")
  165.         self.TLabel1.configure(foreground="#000000")
  166.         self.TLabel1.configure(font="TkDefaultFont")
  167.         self.TLabel1.configure(relief="flat")
  168.         self.TLabel1.configure(textvariable=ttkdemo_support.LabelVar)
  169.  
  170.         self.TSeparator1 = ttk.Separator(top)
  171.         self.TSeparator1.place(x=310, y=40, height=380)
  172.         self.TSeparator1.configure(orient="vertical")
  173.  
  174.         self.TSeparator2 = ttk.Separator(top)
  175.         self.TSeparator2.place(x=40, y=70, width=450)
  176.  
  177. if __name__ == '__main__':
  178.     vp_start_gui()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement