def __init__(self, root):
        self.entry_value = StringVar(root, value="")
        root.title("Calculator")
        root.geometry("860x440")
        root.resizable(width=True, height=True)
        style = ttk.Style()
        style.configure("TButton", font="Serif 15", padding=10)

        style.configure("TEntry", font="Serif 18", padding=10)

        self.number_entry = ttk.Entry(root,
                                      textvariable=self.entry_value,
                                      width=50)
        self.number_entry.grid(row=0, columnspan=4)

        self.button7 = ttk.Button(root,
                                  text="7",
                                  command=lambda: self.button_press('7')).grid(
                                      row=2, column=0)

        self.button8 = ttk.Button(root,
                                  text="8",
                                  command=lambda: self.button_press('8')).grid(
                                      row=2, column=1)

        self.button9 = ttk.Button(root,
                                  text="9",
                                  command=lambda: self.button_press('9')).grid(
                                      row=2, column=2)

        self.button_div = ttk.Button(
            root, text="/",
            command=lambda: self.math_button_press('/')).grid(row=2, column=3)

        self.button4 = ttk.Button(root,
                                  text="4",
                                  command=lambda: self.button_press('4')).grid(
                                      row=3, column=0)

        self.button5 = ttk.Button(root,
                                  text="5",
                                  command=lambda: self.button_press('5')).grid(
                                      row=3, column=1)

        self.button6 = ttk.Button(root,
                                  text="6",
                                  command=lambda: self.button_press('6')).grid(
                                      row=3, column=2)

        self.button_mult = ttk.Button(
            root, text="*",
            command=lambda: self.math_button_press('*')).grid(row=3, column=3)

        self.button1 = ttk.Button(root,
                                  text="1",
                                  command=lambda: self.button_press('1')).grid(
                                      row=4, column=0)

        self.button2 = ttk.Button(root,
                                  text="2",
                                  command=lambda: self.button_press('2')).grid(
                                      row=4, column=1)

        self.button3 = ttk.Button(root,
                                  text="3",
                                  command=lambda: self.button_press('3')).grid(
                                      row=4, column=2)

        self.button_add = ttk.Button(
            root, text="+",
            command=lambda: self.math_button_press('+')).grid(row=5, column=3)

        self.button_clear = ttk.Button(
            root, text="C",
            command=lambda: self.button_press('C')).grid(row=1, column=0)

        self.button0 = ttk.Button(root,
                                  text="0",
                                  command=lambda: self.button_press('0')).grid(
                                      row=5, column=0)

        self.button_equal = ttk.Button(
            root, text="=",
            command=lambda: self.equal_button_press()).grid(row=5, column=2)

        self.button_sub = ttk.Button(
            root, text="-",
            command=lambda: self.math_button_press('-')).grid(row=4, column=3)

        self.button_del = ttk.Button(
            root, text="DEL",
            command=lambda: self.button_press('DEL')).grid(row=1, column=3)

        self.button_dot = ttk.Button(
            root, text=".",
            command=lambda: self.button_press('.')).grid(row=5, column=1)

        self.button_min = ttk.Button(
            root, text="+/-",
            command=lambda: self.button_press('+/-')).grid(row=1, column=1)

        self.button_per = ttk.Button(
            root, text="%",
            command=lambda: self.button_press('%')).grid(row=1, column=2)
示例#2
0
tree.heading('E-mail Conductor', text="E-mail Conductor", anchor=tk.CENTER)
tree.heading('Observacion', text="Observacion", anchor=tk.W)

App.Ver_datos(tree)

# Scrollbar
scrollY = Scrollbar(main, orient="vertical", command=tree.yview)
scrollY.place(x=2, y=2, width=20, height=450)
scrollY.configure(command=tree.yview)

scrollX = Scrollbar(main, orient="horizontal", command=tree.xview)
scrollX.place(x=20, y=450, width=1275, height=20)
scrollX.configure(command=tree.xview)

# Color Treeview
styleT = ttk.Style(main)
styleT.theme_use("alt")
styleT.configure("Treeview",
                 background='#566573',
                 fieldbackground='#17202A',
                 foreground="black")

styleT = ttk.Style(main)
styleT.theme_use("alt")
styleT.configure("Treeview.Heading",
                 background='#566573',
                 fieldbackground='#17202A',
                 foreground="black")

styleS = ttk.Style(main)
styleS.theme_use('alt')
示例#3
0
    def TaxistaInterfaz():
        insertT = tk.Toplevel()

        # Declaracion de variables
        global varA, varI, enAreaT, enClaveT, enPlacaT, enEstado, enNomproT, enNomconT, enMarcaT, enModeloT, enTelproT, enTelconT, enCorreoproT, enCorreoconT, enObservacionesT
        enAreaT = tk.StringVar()
        enClaveT = tk.StringVar()
        enPlacaT = tk.StringVar()
        enEstado = tk.StringVar()
        enNomproT = tk.StringVar()
        enNomconT = tk.StringVar()
        enMarcaT = tk.StringVar()
        enModeloT = tk.StringVar()
        enTelproT = tk.StringVar()
        enTelconT = tk.StringVar()
        enCorreoproT = tk.StringVar()
        enCorreoconT = tk.StringVar()
        enObservacionesT = tk.StringVar()

        # Configuracion de la pantalla
        insertT.title('Insertar datos de Taxistas')
        insertT.geometry('1200x1400')
        insertT.configure(bg='#17202A')

        #Style
        styleT = ttk.Style(insertT)
        styleT.theme_use('alt')
        styleT.configure("TCombobox",
                         background='#566573',
                         fieldbackground='#566573',
                         selectbackground='#566573')
        styleT.map('TCombobox', fieldbackground=[('readonly', '#566573')])
        insertT.option_add('*TCombobox*Listbox.background', '#566573')

        # Label
        tk.Label(insertT, background='#566573', text='Area').place(x=10,
                                                                   y=20,
                                                                   width=100,
                                                                   height=20)
        tk.Label(insertT, background='#566573', text='Clave').place(x=10,
                                                                    y=80,
                                                                    width=100,
                                                                    height=20)
        tk.Label(insertT, background='#566573', text='Placa').place(x=10,
                                                                    y=140,
                                                                    width=100,
                                                                    height=20)
        tk.Label(insertT, background='#566573',
                 text='Estado').place(x=10, y=200, width=200,
                                      height=20)  # Checklist
        tk.Label(insertT, background='#566573',
                 text='Nombre del propietario').place(x=10,
                                                      y=260,
                                                      width=200,
                                                      height=20)
        tk.Label(insertT, background='#566573',
                 text='Nombre del conductor').place(x=10,
                                                    y=320,
                                                    width=200,
                                                    height=20)
        tk.Label(insertT, background='#566573',
                 text='Marca del radio').place(x=600,
                                               y=20,
                                               width=200,
                                               height=20)
        tk.Label(insertT, background='#566573',
                 text='Modelo del radio').place(x=600,
                                                y=80,
                                                width=200,
                                                height=20)
        tk.Label(insertT,
                 background='#566573',
                 text='Telefono del propietario').place(x=600,
                                                        y=140,
                                                        width=200,
                                                        height=20)
        tk.Label(insertT, background='#566573',
                 text='Telefono del conductor').place(x=600,
                                                      y=200,
                                                      width=250,
                                                      height=20)
        tk.Label(insertT,
                 background='#566573',
                 text='Correo electronico del propietario').place(x=600,
                                                                  y=260,
                                                                  width=250,
                                                                  height=20)
        tk.Label(insertT,
                 background='#566573',
                 text='Correo electronico del conductor').place(x=600,
                                                                y=320,
                                                                width=250,
                                                                height=20)
        tk.Label(insertT, background='#566573',
                 text='Observaciones').place(x=600,
                                             y=380,
                                             width=200,
                                             height=20)

        # Entry
        tk.Entry(insertT, background='#566573',
                 textvariable=enAreaT).place(x=50, y=50, width=400, height=20)
        tk.Entry(insertT, background='#566573',
                 textvariable=enClaveT).place(x=50,
                                              y=110,
                                              width=400,
                                              height=20)
        tk.Entry(insertT, background='#566573',
                 textvariable=enPlacaT).place(x=50,
                                              y=170,
                                              width=400,
                                              height=20)
        tk.Entry(insertT, background='#566573',
                 textvariable=enNomproT).place(x=50,
                                               y=290,
                                               width=400,
                                               height=20)
        tk.Entry(insertT, background='#566573',
                 textvariable=enNomconT).place(x=50,
                                               y=350,
                                               width=400,
                                               height=20)
        tk.Entry(insertT, background='#566573',
                 textvariable=enMarcaT).place(x=650,
                                              y=50,
                                              width=400,
                                              height=20)
        tk.Entry(insertT, background='#566573',
                 textvariable=enModeloT).place(x=650,
                                               y=110,
                                               width=400,
                                               height=20)
        tk.Entry(insertT, background='#566573',
                 textvariable=enTelproT).place(x=650,
                                               y=170,
                                               width=400,
                                               height=20)
        tk.Entry(insertT, background='#566573',
                 textvariable=enTelconT).place(x=650,
                                               y=230,
                                               width=400,
                                               height=20)
        tk.Entry(insertT, background='#566573',
                 textvariable=enCorreoproT).place(x=650,
                                                  y=290,
                                                  width=400,
                                                  height=20)
        tk.Entry(insertT, background='#566573',
                 textvariable=enCorreoconT).place(x=650,
                                                  y=350,
                                                  width=400,
                                                  height=20)
        tk.Entry(insertT, background='#566573',
                 textvariable=enObservacionesT).place(x=650,
                                                      y=410,
                                                      width=400,
                                                      height=20)

        # Combobox
        Combobox(insertT,
                 textvariable=enEstado,
                 values=('Activo', 'Inactivo'),
                 state="readonly").place(x=50, y=230, width=400, height=20)

        # Botones
        tk.Button(insertT,
                  background='#566573',
                  activeforeground='#2C3E50',
                  cursor="hand2",
                  text='Ingresar',
                  command=Taxi.Insertar_DatosT).place(x=300,
                                                      y=550,
                                                      width=200,
                                                      height=40)
        tk.Button(insertT,
                  background='#566573',
                  activeforeground='#2C3E50',
                  cursor="hand2",
                  text='Limpiar',
                  command=Taxi.Limpiar_EntryT).place(x=550,
                                                     y=550,
                                                     width=200,
                                                     height=40)
        tk.Button(insertT,
                  background='#566573',
                  activeforeground='#2C3E50',
                  cursor="hand2",
                  text='Regresar',
                  command=insertT.destroy).place(x=800,
                                                 y=550,
                                                 width=200,
                                                 height=40)
#!/usr/bin/python3
# template.py by Barron Stone
# This is an exercise file from Python GUI Development with Tkinter on lynda.com

from tkinter import *
from tkinter import ttk

root = Tk()

button1 = ttk.Button(root, text='Button 1')
button2 = ttk.Button(root, text='Button 2')
button1.pack()
button2.pack()

style = ttk.Style()  # Creating style object

print(style.theme_names())  # Returns all style names on system
print(style.theme_use())  # What system is currently using
style.theme_use('classic')  # Changing theme of buttons
style.theme_use('vista')  # Back to default

print(button1.winfo_class())
style.configure('TButton', foreground='blue')  # Changes text on button to blue

# Tkinter version of derived class. Alarm is derived from TButton so it inherits all its properties
style.configure('Alarm.TButton',
                foreground='orange',
                font=('Arial', 24, 'bold'))

button2.configure(
    style='Alarm.TButton')  # Change button2 style to to new Alarm style
示例#5
0
treev.column("3", width=115, minwidth=30, anchor='c')

treev.heading("1", text="Time")
treev.heading("2", text="Sensor No")
treev.heading("3", text="Temperature °C")

start_range = 0

for record in res[-50:]:
    treev.insert("",
                 index='end',
                 iid=start_range,
                 values=(str(record[2]), int(record[0]), float(record[1])))
    start_range += 1

treev = ttk.Style()
treev.configure('Treeview', rowheight=30)


def _quit():
    root.quit()
    root.destroy()


menu = Menu(root)
root.config(menu=menu)
filemenu = Menu(menu)
menu.add_cascade(label='File', menu=filemenu)
filemenu.add_command(label='New')
filemenu.add_command(label='Open Calendar')
filemenu.add_separator()
示例#6
0
    def __init__(self, root):
        # Will hold the changing value stored in the entry
        self.entry_value = StringVar(root, value="")

        # Define title for the app
        root.title("Calculator")

        # Defines the width and height of the window
        root.geometry("600x300")

        # Block resizing of Window
        root.resizable(width=False, height=False)

        # Customize the styling for the buttons and entry
        style = ttk.Style()
        style.configure("TButton", font="Serif 15", padding=10)

        style.configure("TEntry", font="Serif 18", padding=10)

        # Create the text entry box
        self.number_entry = ttk.Entry(root,
                                      textvariable=self.entry_value,
                                      width=50)
        self.number_entry.grid(row=0, columnspan=4)

        # ----- 1st Row -----

        self.button7 = ttk.Button(root,
                                  text="7",
                                  command=lambda: self.button_press('7')).grid(
                                      row=1, column=0)

        self.button8 = ttk.Button(root,
                                  text="8",
                                  command=lambda: self.button_press('8')).grid(
                                      row=1, column=1)

        self.button9 = ttk.Button(root,
                                  text="9",
                                  command=lambda: self.button_press('9')).grid(
                                      row=1, column=2)

        self.button_div = ttk.Button(
            root, text="/",
            command=lambda: self.math_button_press('/')).grid(row=1, column=3)

        # ----- 2nd Row -----

        self.button4 = ttk.Button(root,
                                  text="4",
                                  command=lambda: self.button_press('4')).grid(
                                      row=2, column=0)

        self.button5 = ttk.Button(root,
                                  text="5",
                                  command=lambda: self.button_press('5')).grid(
                                      row=2, column=1)

        self.button6 = ttk.Button(root,
                                  text="6",
                                  command=lambda: self.button_press('6')).grid(
                                      row=2, column=2)

        self.button_mult = ttk.Button(
            root, text="*",
            command=lambda: self.math_button_press('*')).grid(row=2, column=3)

        # ----- 3rd Row -----

        self.button1 = ttk.Button(root,
                                  text="1",
                                  command=lambda: self.button_press('1')).grid(
                                      row=3, column=0)

        self.button2 = ttk.Button(root,
                                  text="2",
                                  command=lambda: self.button_press('2')).grid(
                                      row=3, column=1)

        self.button3 = ttk.Button(root,
                                  text="3",
                                  command=lambda: self.button_press('3')).grid(
                                      row=3, column=2)

        self.button_add = ttk.Button(
            root, text="+",
            command=lambda: self.math_button_press('+')).grid(row=3, column=3)

        # ----- 4th Row -----

        self.button_clear = ttk.Button(
            root, text="AC",
            command=lambda: self.button_press('AC')).grid(row=4, column=0)

        self.button0 = ttk.Button(root,
                                  text="0",
                                  command=lambda: self.button_press('0')).grid(
                                      row=4, column=1)

        self.button_equal = ttk.Button(
            root, text="=",
            command=lambda: self.equal_button_press()).grid(row=4, column=2)

        self.button_sub = ttk.Button(
            root, text="-",
            command=lambda: self.math_button_press('-')).grid(row=4, column=3)
def create_style():
    # -Style Settings-
    ttk.Style().theme_create('CustomTheme', 'classic')  # , 'vista')
    ttk.Style().theme_use('CustomTheme')
    ttk.Style().element_create('Windows.Button.focus', 'from', 'vista',
                               'Button.focus')
    ttk.Style().element_create('Windows.Radiobutton.indicator', 'from',
                               'vista', 'Radiobutton.indicator')  # nopep8
    ttk.Style().element_create('Windows.Checkbutton.indicator', 'from',
                               'vista', 'Checkbutton.indicator')  # nopep8
    ttk.Style().element_create('Windows.Horizontal.Progressbar.trough', 'from',
                               'vista',
                               'Horizontal.Progressbar.trough')  # nopep8
    ttk.Style().element_create('Windows.Horizontal.Progressbar.pbar', 'from',
                               'vista',
                               'Horizontal.Progressbar.pbar')  # nopep8
    ttk.Style().element_create('Windows.Vertical.Progressbar.trough', 'from',
                               'vista',
                               'Vertical.Progressbar.trough')  # nopep8
    ttk.Style().element_create('Windows.Vertical.Progressbar.pbar', 'from',
                               'vista', 'Vertical.Progressbar.pbar')  # nopep8
    ttk.Style().theme_settings(
        'CustomTheme',
        {
            '.': {
                'configure': {
                    'font': (DEFAULT_FONT, 10),
                    'background': WHITE,
                    'foreground': BLACK,
                    'justify': tk.CENTER,
                    'anchor': tk.CENTER,
                }
            },
            'TCheckbutton': {
                'configure': {
                    'padding': 2,
                    'anchor': tk.W,
                    'justfiy': tk.LEFT,
                },
                'layout': [('Checkbutton.highlight', {
                    'sticky':
                    'nswe',
                    'children': [('Checkbutton.border', {
                        'sticky':
                        'nswe',
                        'children': [('Checkbutton.padding', {
                            'sticky':
                            'nswe',
                            'children': [('Windows.Checkbutton.indicator', {
                                'side': 'left',
                                'sticky': ''
                            }),
                                         ('Checkbutton.label', {
                                             'side': 'left',
                                             'sticky': 'nswe'
                                         })]
                        })]
                    })]
                })]
            },
            'Custom.TCheckbutton': {
                'configure': {
                    'highlightthickness': 1,
                    'padding': 2,
                    'anchor': tk.CENTER
                },
                'map': {
                    'foreground': [('selected', '#005400'),
                                   ('!selected', '#740000')],
                    'background': [('pressed', '#FFFFFF'),
                                   ('active', 'selected', '#E6FBE6'),
                                   ('active', '!selected', '#FFEAEA'),
                                   ('selected', '#D1F7D1'),
                                   ('!selected', '#FFD1D1')],
                    'highlightcolor': [('selected', '#007400'),
                                       ('!selected', '#FF4646')],
                },
                'layout': [('Checkbutton.highlight', {
                    'sticky':
                    'nswe',
                    'children': [('Checkbutton.border', {
                        'sticky':
                        'nswe',
                        'children': [('Checkbutton.padding', {
                            'sticky':
                            'nswe',
                            'children': [('Checkbutton.label', {
                                'sticky': 'nswe',
                            })]
                        })]
                    })]
                })]
            },
            # Windows Button Emulation
            'TButton': {
                'configure': {
                    'background': '#E1E1E1',
                    'highlightcolor': '#ADADAD',
                    'highlightthickness': 1,
                    'padding': 1,
                    'anchor': tk.CENTER,
                    'justify': tk.CENTER,
                },
                'map': {
                    'background': [('pressed', '#CCE4F7'),
                                   ('active', '#E5F1FB')],
                    'highlightcolor': [('pressed', '#005499'),
                                       ('active', '#0078D7')],
                },
                'layout': [('Button.highlight', {
                    'sticky':
                    'nsew',
                    'children': [('Button.button', {
                        'sticky':
                        'nswe',
                        'children': [('Button.padding', {
                            'sticky':
                            'nswe',
                            'children': [('Windows.Button.focus', {
                                'sticky':
                                'nswe',
                                'children': [('Button.label', {
                                    'sticky': 'nswe',
                                })]
                            })]
                        })]
                    })]
                })]
            },
            'Custom.TButton': {
                'configure': {
                    'background': '#F5FAFE',
                    'foreground': '#006CE0',
                    'highlightcolor': '#0072BE',
                    'highlightthickness': 1,
                    'padding': 1,
                    'anchor': tk.CENTER,
                    'justify': tk.CENTER,
                },
                'map': {
                    'background': [('pressed', '#D1ECFF'),
                                   ('active', '#E1F2FF')],
                    'highlightcolor': [('focus', '#0072BE'),
                                       ('active', '#0078D7')],
                },
                'layout': [('Button.highlight', {
                    'sticky':
                    'nsew',
                    'children': [('Button.button', {
                        'sticky':
                        'nswe',
                        'children': [('Button.padding', {
                            'sticky':
                            'nswe',
                            'children': [('Button.label', {
                                'sticky': 'nswe',
                            })]
                        })]
                    })]
                })]
            },
            'TEntry': {
                'configure': {
                    'fieldbackground': WHITE,
                    'selectbackground': '#0078D7',
                    'selectforeground': WHITE,
                    'highlightcolor': '#7A7A7A',
                    'padding': 3,
                    'highlightthickness': 1,
                    'borderwidth': 0,
                },
                'map': {
                    'highlightcolor': [
                        ('focus', '#0078D7'),
                    ],
                },
            },
            'TRadiobutton': {
                'configure': {
                    'padding': 3,
                    'borderwidth': 0,
                    'anchor': tk.W,
                    'justify': tk.LEFT,
                },
                'map': {},
                'layout': [('Radiobutton.highlight', {
                    'sticky':
                    'nswe',
                    'children': [('Radiobutton.border', {
                        'sticky':
                        'nswe',
                        'children': [('Radiobutton.padding', {
                            'sticky':
                            'nswe',
                            'children': [('Windows.Radiobutton.indicator', {
                                'side': 'left',
                                'sticky': '',
                            }),
                                         ('Radiobutton.padding', {
                                             'sticky':
                                             'nswe',
                                             'children':
                                             [('MyRadiobutton.label', {
                                                 'sticky': 'nswe',
                                             })]
                                         })]
                        })]
                    })]
                })]
            },
            'Custom.TRadiobutton': {
                'configure': {
                    'background': '#F5FAFE',
                    'foreground': '#006FB9',
                    'padding': 3,
                    'borderwidth': 0,
                    'anchor': tk.W,
                    'justify': tk.LEFT,
                },
                'map': {
                    'background': [('selected', '#B2E0FF'),
                                   ('active', '#D5EEFF'),
                                   ('focus', '#D5EEFF')],
                    'highlightthickness': [('focus', 1), ('!focus', 0)],
                    'highlightcolor': [('focus', '#0072BE'),
                                       ('!focus', WHITE)],
                },
                'layout': [('Radiobutton.highlight', {
                    'sticky':
                    'nswe',
                    'children': [('Radiobutton.border', {
                        'sticky':
                        'nswe',
                        'children': [('Radiobutton.padding', {
                            'sticky':
                            'nswe',
                            'children': [('MyRadiobutton.label', {
                                'sticky': 'nswe',
                            })]
                        })]
                    })]
                })]
            },
            'Horizontal.TProgressbar': {
                'configure': {
                    'troughcolor': WHITE
                },
                'map': {},
                'layout': [('Windows.Horizontal.Progressbar.trough', {
                    'sticky':
                    'nswe',
                    'children': [('Windows.Horizontal.Progressbar.pbar', {
                        'side': 'left',
                        'sticky': 'ns'
                    })]
                })]
            },
            'DarkTheme.Horizontal.TProgressbar': {
                'configure': {
                    'troughcolor': '#212121',
                    'troughrelief': tk.FLAT,
                    'pbarrelief': tk.FLAT,
                    'background': '#BB86FC',
                },
                'map': {},
                'layout': [('Horizontal.Progressbar.trough', {
                    'sticky':
                    'nswe',
                    'children': [('Horizontal.Progressbar.pbar', {
                        'side': 'left',
                        'sticky': 'ns'
                    })]
                })]
            },
            'Vertical.TProgressbar': {
                'configure': {
                    'troughcolor': WHITE
                },
                'map': {},
                'layout': [('Windows.Vertical.Progressbar.trough', {
                    'sticky':
                    'nswe',
                    'children': [('Windows.Vertical.Progressbar.pbar', {
                        'side': 'left',
                        'sticky': 'ns'
                    })]
                })]
            }
        })
    ttk.Style().theme_use('CustomTheme')
示例#8
0
    def analyte_pane(self):
        self.anwin = ttk.PanedWindow(self, orient=tk.VERTICAL)
        self.anwin.grid(row=1, column=0, columnspan=1, sticky='nw')

        lab = ttk.Label(self, text='Analytes')
        lab.grid(column=0, row=1, sticky='we')
        lab.grid_columnconfigure(0, weight=1)
        self.anwin.add(lab)

        # list of analytes for plotting
        self.achecks = {}
        self.p_i = 2
        style = ttk.Style()
        for a in self.dat.analytes:
            self.achecks[a] = {'a': a, 'val': tk.IntVar(value=1)}
            style.configure(a + '.TCheckbutton', foreground=self.dat.cmaps[a])
            self.achecks[a]['but'] = ttk.Checkbutton(
                self,
                variable=self.achecks[a]['val'],
                text=self.achecks[a]['a'],
                style=a + '.TCheckbutton',
                command=self.updatePlot)
            self.achecks[a]['but'].grid(column=0, row=self.p_i, sticky='nw')
            self.p_i += 1
            self.anwin.add(self.achecks[a]['but'])

        # drop-down list of samples
        lab = ttk.Label(self, text='Samples')
        lab.grid(column=0, row=self.p_i, sticky='we')
        # lab.grid_columnconfigure(0, weight=1)
        self.anwin.add(lab)
        self.p_i += 1

        self.live_sample = tk.StringVar()
        self.live_sample.set(self.dat.data[0].sample)

        sdrop = ttk.Combobox(self, textvariable=self.live_sample)
        sdrop['values'] = tuple(self.dat.samples)
        sdrop.bind('<<ComboboxSelected>>', self.updatePlot)
        self.anwin.add(sdrop)

        # Plot options
        lab = ttk.Label(self, text='Plot Options')
        lab.grid(column=0, row=self.p_i, sticky='we')
        # lab.grid_columnconfigure(0, weight=1)
        self.anwin.add(lab)
        self.p_i += 1

        # Plot on a log scale
        self.logon = tk.IntVar(value=1)
        logswitch = ttk.Checkbutton(self,
                                    variable=self.logon,
                                    command=self.updatePlot,
                                    text='Log Scale')
        logswitch.grid(column=0, row=self.p_i, sticky='we')
        self.anwin.add(logswitch)
        self.p_i += 1

        # Show Signal and Background Ranges
        self.rngon = tk.IntVar(value=0)
        rngswitch = ttk.Checkbutton(self,
                                    variable=self.rngon,
                                    command=self.updatePlot,
                                    text='Display Ranges')
        rngswitch.grid(column=0, row=self.p_i, sticky='we')
        self.anwin.add(rngswitch)
        self.p_i += 1
示例#9
0
    def __init__(self):
        global root
        root = tk.Tk()

        windowWidth = root.winfo_reqwidth()
        windowHeight = root.winfo_reqheight()
        X = int(root.winfo_screenwidth() / 2 - windowWidth / 2)
        Y = int(root.winfo_screenheight() / 3 - windowHeight / 2)
        X = int(X * 0.9)
        Y = int(Y * 0.9)

        _bgcolor = '#d9d9d9'  # X11 color: 'gray85'
        _fgcolor = '#000000'  # X11 color: 'black'
        _compcolor = '#d9d9d9'  # X11 color: 'gray85'
        _ana1color = '#d9d9d9'  # X11 color: 'gray85'
        _ana2color = '#ececec'  # Closest X11 color: 'gray92'

        self.style = ttk.Style()
        if sys.platform == "win32":
            self.style.theme_use('winnative')
        self.style.configure('.', background=_bgcolor)
        self.style.configure('.', foreground=_fgcolor)
        self.style.configure('.', font="TkDefaultFont")
        self.style.map('.',
                       background=[('selected', _compcolor),
                                   ('active', _ana2color)])

        root.geometry("391x173+{}+{}".format(X, Y))
        root.minsize(120, 1)
        root.maxsize(3844, 1061)
        root.resizable(1, 1)
        root.title("Verificar Registro de Usuário")
        root.configure(background="#d9d9d9")
        root.configure(highlightbackground="#d9d9d9")
        root.configure(highlightcolor="black")

        self.TFrame1MsgCadastrado = ttk.Frame(root)
        self.TFrame1MsgCadastrado.place(relx=0.013,
                                        rely=0.046,
                                        relheight=0.913,
                                        relwidth=0.974)
        self.TFrame1MsgCadastrado.configure(relief='groove')
        self.TFrame1MsgCadastrado.configure(borderwidth="2")
        self.TFrame1MsgCadastrado.configure(relief="groove")

        self.BotaoConfirmar = ttk.Button(
            self.TFrame1MsgCadastrado,
            command=lambda: self.receberCPF(self.TEntry1))
        self.BotaoConfirmar.place(relx=0.276, rely=0.759, height=25, width=67)
        self.BotaoConfirmar.configure(takefocus="")
        self.BotaoConfirmar.configure(text='''Confirmar''')
        self.BotaoConfirmar.configure(cursor="hand2")

        self.labelMsg = ttk.Label(self.TFrame1MsgCadastrado)
        self.labelMsg.place(relx=0.021, rely=0.19, height=30, width=365)
        self.labelMsg.configure(background="#d9d9d9")
        self.labelMsg.configure(foreground="#000000")
        self.labelMsg.configure(font="-family {Yu Gothic} -size 12")
        self.labelMsg.configure(relief="flat")
        self.labelMsg.configure(anchor='n')
        self.labelMsg.configure(justify='left')
        self.labelMsg.configure(text='''Por favor, insira seu CFP:''')

        self.BotaoCancelar = ttk.Button(self.TFrame1MsgCadastrado,
                                        command=lambda: self.encerrar())
        self.BotaoCancelar.place(relx=0.53, rely=0.759, height=25, width=68)
        self.BotaoCancelar.configure(takefocus="")
        self.BotaoCancelar.configure(text='''Cancelar''')
        self.BotaoCancelar.configure(cursor="hand2")

        self.TEntry1 = ttk.Entry(self.TFrame1MsgCadastrado)
        self.TEntry1.place(relx=0.328,
                           rely=0.38,
                           relheight=0.133,
                           relwidth=0.331)
        self.TEntry1.configure(takefocus="")
        self.TEntry1.configure(cursor="ibeam")

        self.menubar = tk.Menu(root,
                               font="TkMenuFont",
                               bg=_bgcolor,
                               fg=_fgcolor)
        root.configure(menu=self.menubar)
示例#10
0
def add_file():
    global current_dir
    file: str = askopenfilename(initialdir=current_dir,
                                filetypes=(("Wasm files", "*.wasm"),
                                           ("All Files", "*.*")),
                                title="Choose a wasm file.")
    if file:
        file_label.configure(text="Compressing: " + os.path.basename(file))
        progress_bar.start(4)
        compress_file: ClassVar = threading.Thread(target=compress,
                                                   args=(file, ))
        compress_file.daemon = True
        compress_file.start()


main_style: ClassVar = ttk.Style()
main_style.theme_use('clam')
main_style.configure("TButton",
                     background='#fff',
                     relief="flat",
                     font=('Bahnschrift', 12),
                     foreground='#000')
main_style.configure("TLabel",
                     background='#fff',
                     foreground='#000',
                     border='0',
                     font=('Bahnschrift', 11))
main_style.configure("G.Horizontal.TProgressbar",
                     foreground='#fff',
                     background='#000',
                     lightcolor='#fff',
##############################################################
'''style = ttk.Style()

style.map('TCombobox', fieldbackground=[('readonly','white')])
style.map('TCombobox', selectbackground=[('readonly', 'white')])
style.map('TCombobox', selectforeground=[('readonly', 'black')])

mycombo = ttk.Combobox(window, height=15,justify='left',width=21)

window.mycombo['state'] = 'readonly' # Set the state according to configure colors
window.mycombo.bind('<<ComboboxSelected>>',
                      lambda event: window._click_combo())
'''
##############################################################

ttk.Style().configure('TCombobox', relief='flat')
cmb = ttk.Combobox(window, state="readonly", width=20, font="Verdana 16 bold")
cmb['values'] = ('Subway Suffers', 'No More Games Available!')
cmb.current(0)
cmb.place(x=600, y=300, anchor=NW)
'''style = ttk.Style()
self.mycombo = ttk.Combobox(self.frame,textvariable=self.combo_var, height=15,justify='left',width=21, values=lista)
self.mycombo['state'] = 'readonly' # Set the state according to configure colors
self.mycombo.bind('<<ComboboxSelected>>', lambda event: self._click_combo())'''

frame1 = Frame(window, width=300, bg='white')
frame1.place(x=400, y=400, anchor=NW)

img1 = PhotoImage(file="s1.png")
label2 = Label(frame1, image=img1)
label2.grid(row=0, column=0)
示例#12
0
 def changeRed(self):
     s = ttk.Style()
     s.configure('My.TFrame', background = 'red')
     s.configure("My.TLabel", background = 'red')
示例#13
0
 def changeGreen(self):
     s = ttk.Style()
     s.configure('My.TFrame', background = 'green')
     s.configure("My.TLabel", background = 'green')
示例#14
0
##########################################################
# I WILL BE IMPORTING THIS TEXT TO SPEECH CODE WITHIN THE CHATBOT CODE
# THIS WILL READ OUT LOUD WHAT THE BOT REPLIES
# WILL STAY AS ITS OWN FILE UNTIL CHATBOT IS IN A MORE COMPLETE STATE
##########################################################
import tkinter as tk
from tkinter import *
from tkinter import ttk
from tkinter.scrolledtext import *

window = tk.Tk()
window.title("Read-O-Tron")
window.geometry('700x600')
window.config(background='blue')
style = ttk.Style(window)
style.configure('lefttab.TNotebook', tabposition='wn')
tab_control = ttk.Notebook(window, style='lefttab.TNotebook')
tab_main = ttk.Frame(tab_control)
tab_control.add(tab_main, text='Mission Control')

label_summarize = Label(
    tab_main,
    text="\nHi, I am Read-A-Tron. Let me read your text outload to you.\n",
    pady=5)

label_summarize.grid(column=0, row=0)
tab_control.pack(expand=1, fill='both')


def erase_inout():
    entry.delete('1.0', END)
示例#15
0
    def __init__(self):
        super().__init__()

        style = ttk.Style()
        style.theme_use("clam")

        style.configure("Dashboard.TFrame", background=COLOR_LIGHT_BACKGROUND)

        style.configure("BackgroundRED.TFrame", background="red")
        style.configure("BackgroundBLUE.TFrame", background="blue")
        style.configure("BackgroundGREEN.TFrame", background="green")
        style.configure("BackgroundYELLOW.TFrame", background="yellow")
        style.configure("BackgroundPURPLE.TFrame", background="purple")
        style.configure("BackgroundWHITE.TFrame", background="white")
        style.configure("BackgroundORANGE.TFrame", background="orange")
        style.configure("BackgroundControlPanel.TFrame", background="#222a2e")
        style.configure("BackgroundGraph.TFrame", background="#334148")

        style.configure("Background.TFrame", background=COLOR_PRIMARY)
        style.configure("Dashboard.TLabel",
                        background=COLOR_LIGHT_BACKGROUND,
                        foreground=COLOR_DARK_TEXT,
                        font="Courier 46")

        style.configure(
            "LightText.TLabel",
            background="#334148",
            foreground="white",
            font=("TkDefaultFont", 22),
        )

        style.configure("LightTextEntry.TLabel",
                        background="#70b88d",
                        foreground="white",
                        font=("TkDefaultFont", 20))

        style.configure("LightText6.TLabel",
                        background="#222a2e",
                        foreground="white",
                        font=("TkDefaultFont", 20))

        style.configure("LightText8.TLabel",
                        background="#334148",
                        foreground="#fff8e7",
                        font=("TkDefaultFont", 80))

        style.configure("LightTextEntry2.TLabel",
                        background="#de9578",
                        foreground="white",
                        font=("TkDefaultFont", 20))

        style.configure("LightTextEntry4.TLabel",
                        background="#bfbb73",
                        foreground="white",
                        font=("TkDefaultFont", 20))

        style.configure("LightTextEntry3.TLabel",
                        background="#978fdb",
                        foreground="white",
                        font=("TkDefaultFont", 20))
        style.configure("LightTextEntry7.TLabel",
                        background='#04a7e0',
                        foreground="white",
                        font=("TkDefaultFont", 20))

        style.configure("Button.TButton",
                        background=[COLOR_SECONDARY],
                        foreground=COLOR_LIGHT_TEXT,
                        font=("TkDefaultFont", 22),
                        activebackground="black")

        style.configure("info_button.TButton",
                        background="black",
                        foreground="white",
                        font=("TkDefaultFont", 11))

        style.map("Button.TButton",
                  background=[("active", COLOR_PRIMARY),
                              ("disabled", COLOR_LIGHT_TEXT)])

        SCREEN_WIDTH = self.winfo_screenwidth()
        SCREEN_HEIGHT = self.winfo_screenheight()

        self["background"] = COLOR_PRIMARY

        self.columnconfigure(0, weight=1)
        self.rowconfigure(0, weight=1)

        container = ttk.Frame(self)
        container["height"] = SCREEN_HEIGHT
        container["width"] = SCREEN_WIDTH
        container.grid()
        container.columnconfigure(0, weight=1)

        self.frames = {}

        dashboard_frame = Dashboard(container,
                                    self,
                                    lambda: self.show_frame(Dashboard),
                                    height=SCREEN_HEIGHT,
                                    width=SCREEN_WIDTH)
        dashboard_frame.grid(row=0, column=0, sticky="NESW")

        self.frames[Dashboard] = dashboard_frame

        self.show_frame(Dashboard)

        self.title('Design Of An Electric Circuit')
        self.geometry(f"{SCREEN_WIDTH}x{SCREEN_HEIGHT}")
        self.resizable(False, False)

        self.update()
示例#16
0
    def __init__(self):
        global root
        root = tk.Tk()
        self.sucessoCadastro = False

        windowWidth = root.winfo_reqwidth()
        windowHeight = root.winfo_reqheight()
        X = int(root.winfo_screenwidth()/2 - windowWidth/2)
        Y = int(root.winfo_screenheight()/3 - windowHeight/2)
        X = int(X * 0.9)
        Y = int(Y * 0.9)

        _bgcolor = '#d9d9d9'  # X11 color: 'gray85'
        _fgcolor = '#000000'  # X11 color: 'black'
        _compcolor = '#d9d9d9' # X11 color: 'gray85'
        _ana1color = '#d9d9d9' # X11 color: 'gray85'
        _ana2color = '#ececec' # Closest X11 color: 'gray92'

        self.style = ttk.Style()
        if sys.platform == "win32":
            self.style.theme_use('winnative')
        self.style.configure('.',background=_bgcolor)
        self.style.configure('.',foreground=_fgcolor)
        self.style.configure('.',font="TkDefaultFont")
        self.style.map('.',background=[('selected', _compcolor), ('active',_ana2color)])

        root.geometry("516x386+{}+{}".format(X, Y))
        root.minsize(120, 1)
        root.maxsize(3844, 1061)
        root.resizable(1, 1)
        root.title("Nova Conta Poupança")
        root.configure(background="#d9d9d9")
        root.configure(highlightbackground="#d9d9d9")
        root.configure(highlightcolor="black")

        self.TFrame1 = ttk.Frame(root)
        self.TFrame1.place(relx=0.019, rely=0.026, relheight=0.935
                , relwidth=0.959)
        self.TFrame1.configure(relief='groove')
        self.TFrame1.configure(borderwidth="2")
        self.TFrame1.configure(relief="groove")

        self.Titulo = ttk.Label(self.TFrame1)
        self.Titulo.place(relx=0.081, rely=0.028, height=42, width=416)
        self.Titulo.configure(background="#d9d9d9")
        self.Titulo.configure(foreground="#000000")
        self.Titulo.configure(font="-family {Yu Mincho} -size 21 -slant italic")
        self.Titulo.configure(relief="flat")
        self.Titulo.configure(anchor='center')
        self.Titulo.configure(justify='left')
        self.Titulo.configure(text='''Cadastro conta poupança''')
        self.Titulo.configure(compound='center')

        self.BotaoCancelar = ttk.Button(self.TFrame1, command=lambda: self.encerrar())
        self.BotaoCancelar.place(relx=0.566, rely=0.831, height=25, width=80)
        self.BotaoCancelar.configure(takefocus="")
        self.BotaoCancelar.configure(text='''Cancelar''')
        self.BotaoCancelar.configure(cursor="hand2")

        self.BotaoConfirmar = ttk.Button(self.TFrame1, command=lambda: self.pegarInputs(self.entryNome, self.entryDataAbertura, self.entryDataVencimento, self.entryNumAgencia, self.entryNumConta, self.entrySaldo, self.entryRendimento))
        self.BotaoConfirmar.place(relx=0.263, rely=0.831, height=28, width=80)
        self.BotaoConfirmar.configure(takefocus="")
        self.BotaoConfirmar.configure(text='''Confirmar''')
        self.BotaoConfirmar.configure(cursor="hand2")

        self.entryNome = ttk.Entry(self.TFrame1)
        self.entryNome.place(relx=0.303, rely=0.194, relheight=0.058, relwidth=0.598)
        self.entryNome.configure(takefocus="")
        self.entryNome.configure(cursor="ibeam")

        self.entryDataAbertura = ttk.Entry(self.TFrame1)
        self.entryDataAbertura.place(relx=0.303, rely=0.277, relheight=0.058, relwidth=0.598)
        self.entryDataAbertura.configure(takefocus="")
        self.entryDataAbertura.configure(cursor="ibeam")

        self.entryNumAgencia = ttk.Entry(self.TFrame1)
        self.entryNumAgencia.place(relx=0.303, rely=0.443, relheight=0.058, relwidth=0.598)
        self.entryNumAgencia.configure(takefocus="")
        self.entryNumAgencia.configure(cursor="ibeam")

        self.entryNumConta = ttk.Entry(self.TFrame1)
        self.entryNumConta.place(relx=0.303, rely=0.526, relheight=0.058, relwidth=0.598)
        self.entryNumConta.configure(takefocus="")
        self.entryNumConta.configure(cursor="ibeam")

        self.labelNome = ttk.Label(self.TFrame1)
        self.labelNome.place(relx=0.081, rely=0.194, height=21, width=96)
        self.labelNome.configure(background="#d9d9d9")
        self.labelNome.configure(foreground="#000000")
        self.labelNome.configure(font="TkDefaultFont")
        self.labelNome.configure(relief="flat")
        self.labelNome.configure(anchor='e')
        self.labelNome.configure(justify='left')
        self.labelNome.configure(text='''Nome do titular:''')

        self.labelDataAbertura = ttk.Label(self.TFrame1)
        self.labelDataAbertura.place(relx=0.081, rely=0.277, height=21, width=96)

        self.labelDataAbertura.configure(background="#d9d9d9")
        self.labelDataAbertura.configure(foreground="#000000")
        self.labelDataAbertura.configure(font="TkDefaultFont")
        self.labelDataAbertura.configure(relief="flat")
        self.labelDataAbertura.configure(anchor='e')
        self.labelDataAbertura.configure(justify='left')
        self.labelDataAbertura.configure(text='''Data de abertura:''')

        self.labelNumAgencia = ttk.Label(self.TFrame1)
        self.labelNumAgencia.place(relx=0.04, rely=0.443, height=21, width=116)
        self.labelNumAgencia.configure(background="#d9d9d9")
        self.labelNumAgencia.configure(foreground="#000000")
        self.labelNumAgencia.configure(font="TkDefaultFont")
        self.labelNumAgencia.configure(relief="flat")
        self.labelNumAgencia.configure(anchor='e')
        self.labelNumAgencia.configure(justify='left')
        self.labelNumAgencia.configure(text='''Número da agência:''')

        self.labelNumConta = ttk.Label(self.TFrame1)
        self.labelNumConta.place(relx=0.061, rely=0.526, height=21, width=106)
        self.labelNumConta.configure(background="#d9d9d9")
        self.labelNumConta.configure(foreground="#000000")
        self.labelNumConta.configure(font="TkDefaultFont")
        self.labelNumConta.configure(relief="flat")
        self.labelNumConta.configure(anchor='e')
        self.labelNumConta.configure(justify='left')
        self.labelNumConta.configure(text='''Número da conta:''')

        self.labelSaldo = ttk.Label(self.TFrame1)
        self.labelSaldo.place(relx=0.182, rely=0.609, height=21, width=46)
        self.labelSaldo.configure(background="#d9d9d9")
        self.labelSaldo.configure(foreground="#000000")
        self.labelSaldo.configure(font="TkDefaultFont")
        self.labelSaldo.configure(relief="flat")
        self.labelSaldo.configure(anchor='e')
        self.labelSaldo.configure(justify='left')
        self.labelSaldo.configure(text='''Saldo:''')

        self.entrySaldo = ttk.Entry(self.TFrame1)
        self.entrySaldo.place(relx=0.303, rely=0.609, relheight=0.058, relwidth=0.598)
        self.entrySaldo.configure(takefocus="")
        self.entrySaldo.configure(cursor="ibeam")

        self.entryRendimento = ttk.Entry(self.TFrame1)
        self.entryRendimento.place(relx=0.303, rely=0.693, relheight=0.058, relwidth=0.598)
        self.entryRendimento.configure(takefocus="")
        self.entryRendimento.configure(cursor="ibeam")

        self.labelRendimento = ttk.Label(self.TFrame1)
        self.labelRendimento.place(relx=0.05, rely=0.693, height=21, width=110)
        self.labelRendimento.configure(background="#d9d9d9")
        self.labelRendimento.configure(foreground="#000000")
        self.labelRendimento.configure(font="TkDefaultFont")
        self.labelRendimento.configure(relief="flat")
        self.labelRendimento.configure(anchor='e')
        self.labelRendimento.configure(justify='left')
        self.labelRendimento.configure(text='''Dia do rendimento:''')

        self.labelDataVencimento = ttk.Label(self.TFrame1)
        self.labelDataVencimento.place(relx=0.04, rely=0.36, height=21, width=116)
        self.labelDataVencimento.configure(background="#d9d9d9")
        self.labelDataVencimento.configure(foreground="#000000")
        self.labelDataVencimento.configure(font="TkDefaultFont")
        self.labelDataVencimento.configure(relief="flat")
        self.labelDataVencimento.configure(anchor='e')
        self.labelDataVencimento.configure(justify='left')
        self.labelDataVencimento.configure(text='''Data de vencimento:''')

        self.entryDataVencimento = ttk.Entry(self.TFrame1)
        self.entryDataVencimento.place(relx=0.303, rely=0.36, relheight=0.058, relwidth=0.598)
        self.entryDataVencimento.configure(takefocus="")
        self.entryDataVencimento.configure(cursor="ibeam")

        self.menubar = tk.Menu(root,font="TkMenuFont",bg=_bgcolor,fg=_fgcolor)
        root.configure(menu = self.menubar)
示例#17
0
    def _create_widgets(self):
        style = ttk.Style()
        style.configure("BW.TLabel", foreground="black", background="white")

        self._search_bar = ttk.Entry(master=self._root_window,
                                     textvariable=self._search_note)

        self._search_bar.bind("<Button-1>", self._delete_default_text)
        self._search_bar.bind("<Return>", self._search_song)

        self._display_label = ttk.Label(master=self._root_window,
                                        textvariable=self._var,
                                        font=_DEFAULT_FONT,
                                        style="BW.TLabel",
                                        anchor="center")

        self._volume_label = tkinter.Label(master=self._root_window,
                                           text="Volume",
                                           font=('Arial', 12),
                                           anchor="center")

        self._volume_control = ttk.Scale(master=self._root_window,
                                         from_=0,
                                         to_=100,
                                         orient=tkinter.HORIZONTAL,
                                         command=self._player.set_curr_vol)

        ttk.Style().configure("TButton",
                              padding=6,
                              relief="flat",
                              background="#ccc")

        self._play_button = ttk.Button(self._root_window,
                                       text="PLAY",
                                       command=self._play_button_switch,
                                       style="TButton")

        self._stop_button = ttk.Button(master=self._root_window,
                                       text='STOP',
                                       command=self._stop_selected_song,
                                       style="TButton")

        self._next_button = ttk.Button(master=self._root_window,
                                       text='NEXT',
                                       command=self._play_next_song,
                                       style="TButton")

        self._end_label = ttk.Label(master=self._root_window,
                                    textvariable=self._tar,
                                    font=("Arial", 10))

        self._playlist_frame = tkinter.LabelFrame(self._root_window,
                                                  text='Playlist',
                                                  font=('Arial', 10))

        self._playlist = ttk.Treeview(self._playlist_frame)
        self._playlist["columns"] = ("one", "two")
        self._playlist.column("#0",
                              width=270,
                              minwidth=270,
                              stretch=tkinter.NO)

        self._playlist.heading("#0", text="Song Name", anchor=tkinter.W)

        ##        self._playlist = ttk.Listbox(
        ##            master = self._playlist_frame,
        ##            selectmode = tkinter.SINGLE)

        self._playlist.bind('<Double-Button-1>', self._play_selected_song)
示例#18
0
    def __init__(self, master=None):
        super().__init__(master)
        self.master = master
        self.valor_negrito = tk.IntVar()
        self.valor_italico = tk.IntVar()
        self.valor_sublinhado = tk.IntVar()
        self.radio_link_var = tk.IntVar()
        self.radio_csv_var = tk.IntVar()
        self.radio_google_var = tk.IntVar()
        self.radio_dv_var = tk.IntVar()
        self.radio_form_var = tk.IntVar()
        self.pack()
        self.google_chrome = self.busca_google_chrome()

        # cria os componentes da janela
        # estilos

        style = ttk.Style()
        style.configure('TFrame', foreground="black", background='gray')
        style.configure('TNotebook', foreground="black", background='gray', font='Helvetica 11 bold', borderwidth=0)
        style.configure('TNotebook.Tab', background='#6a6a6a', borderwidth=1)
        style.map('TNotebook.Tab', background=[('selected', 'gray'), ('active', '#606060')],
                  foreground=[('selected', 'black'), ('active', '#bababa')])
        style.configure('Title.TLabel', foreground="black", background="gray", padding=1, font='Helvetica 11 bold')
        style.configure('BG.TLabel', foreground="black", background="gray", padding=1)
        style.configure('BW.TButton', foreground='#bfbfbf', background='black', highlightbackground='black',
                        width=46, font='Helvetica 11')
        style.configure('BG.TCheckbutton', selectcolor='#818181', foreground="black", background="gray",
                        bd=1, width=7, anchor='w')
        style.configure('Combo.TCombobox', foreground="black", background="gray", bordercolor='black')
        style_button = {'width': 41, 'bg': '#31363b', 'fg': 'white', 'font': 'Helvetica 9',
                        'highlightbackground': 'black', 'cursor': 'hand2'}
        style_button_2 = {'width': 18, 'bg': '#31363b', 'fg': 'white', 'font': 'Helvetica 9',
                        'highlightbackground': 'black', 'cursor': 'hand2'}
        style_entry = {'bg': '#33425c', 'fg': 'orange', 'width': 45, 'font': 'Arial 10'}
        style_radio = {'foreground': 'black', 'background': 'gray', 'indicatoron': 0, 'bd': 1, 'relief': tk.FLAT,
                       'font': 'Arial 10'}

        self.configure(bg='gray')

        # tabs
        self.tab_frame = tk.Frame(self.master, bg='gray')
        self.tab_frame.pack()
        self.tabControl = ttk.Notebook(self.tab_frame, style='TNotebook')  # Create Tab Control
        self.tab1 = ttk.Frame(self.tabControl, style='TFrame')  # Create a tab
        self.tabControl.add(self.tab1, text='e-Processo')  # Add the tab
        self.tab1a = ttk.Frame(self.tabControl, style='TFrame')  # Create a tab
        self.tabControl.add(self.tab1a, text='Arquivos')  # Add the tab
        self.tab2 = ttk.Frame(self.tabControl, style='TFrame')  # Add a second tab
        self.tabControl.add(self.tab2, text='Outros')  # Make second tab visible
        self.tabControl.pack()  # Pack to make visible
        # self.tabControl.pack(expand=1, fill="both")  # Pack to make visible

        # widgets
        # tab 1
        # formata texto
        ttk.Label(self.tab1, text='Formata texto para nota', style='Title.TLabel').pack(pady=3)
        self.frame_formato = tk.Frame(self.tab1, width=35, bg='gray')
        self.frame_formato.pack()
        # ttk.Label(self.tab1, text='Estilo:', style='BG.TLabel').grid(row=1, column=0, sticky='w', padx=2)
        self.check_negrito = ttk.Checkbutton(self.frame_formato, text='Negrito', variable=self.valor_negrito,
                                             style='BG.TCheckbutton')
        self.check_negrito.grid(row=0, column=0)
        self.valor_negrito.set('1')
        self.check_italico = ttk.Checkbutton(self.frame_formato, text='Itálico', variable=self.valor_italico,
                                             style='BG.TCheckbutton')
        self.check_italico.grid(row=0, column=1)
        self.check_sublinhado = ttk.Checkbutton(self.frame_formato, text='Sublin.', variable=self.valor_sublinhado,
                                                style='BG.TCheckbutton')
        self.check_sublinhado.grid(row=0, column=2)
        # ttk.Label(self.frame_formato, text='Cor:', style='BG.TLabel').grid(row=0, column=3, sticky='e')
        self.combo_color = ttk.Combobox(self.frame_formato, values=['Preto', 'Azul', 'Verde', 'Vermelho'],
                                        style='Combo.TCombobox',
                                        exportselection=0, width=8)
        self.combo_color.grid(row=0, column=3, pady=3)
        self.combo_color.set('Preto')
        self.texto_nota = tk.Text(self.frame_formato, width=45, height=5, bg='#33425c', fg='orange', font='Arial 10',
                                  wrap=tk.WORD)  # bg original ='#125487'
        self.texto_nota.grid(row=1, columnspan=4, padx=3)
        self.texto_nota.insert(
            tk.INSERT, 'Insira o texto da Nota aqui.')
        self.texto_nota.bind('<Escape>', self.exit)  # com um Esc encera o programa
        self.bt_gera_nota = tk.Button(self.tab1, style_button, text='Gera nota formatada',
                                      command=self.formata_texto_nota)
        self.bt_gera_nota.pack()
        tt.ToolTip(self.bt_gera_nota, 'Gera nota com o texto acima formatado conforme as seleções de estilo e cor')
        ttk.Separator(self.tab1, orient=tk.HORIZONTAL).pack(fill=tk.X, padx=8, pady=3)

        # Inclui link
        ttk.Label(self.tab1, text='Inclui link em nota', style='Title.TLabel').pack(pady=3)
        self.frame_link = tk.Frame(self.tab1, width=35, bg='gray')
        self.frame_link.pack()
        self.radio_link_processo = tk.Radiobutton(self.frame_link, style_radio, text="Processo",
                                                  variable=self.radio_link_var,
                                                  value=1, width=17)
        self.radio_link_processo.grid(row=0, column=0, padx=3, pady=3, sticky='we')
        tt.ToolTip(self.radio_link_processo, 'Gera nota com link para processo.')
        self.radio_link_url = tk.Radiobutton(self.frame_link, style_radio, text='URL', variable=self.radio_link_var,
                                             value=2, width=17)
        self.radio_link_url.grid(row=0, column=1, padx=3, pady=3, sticky='we')
        self.radio_link_processo.select()
        tt.ToolTip(self.radio_link_url, 'Gera nota com link para url (http://...)')

        self.entry_link = tk.Entry(self.tab1, style_entry)
        self.entry_link.pack()
        # self.entry_link.insert(0, 'http://receita.economia.gov.br/')
        self.entry_link.bind('<Escape>', self.exit)  # com um Esc encera o programa
        self.bt_gera_link = tk.Button(self.tab1, style_button, text='Gera link para nota', command=self.link)
        self.bt_gera_link.pack()
        tt.ToolTip(self.bt_gera_link, 'Gera nota com link para o processo ou a url indicado acima')
        ttk.Separator(self.tab1, orient=tk.HORIZONTAL).pack(fill=tk.X, padx=8, pady=3)

        # Transpõe processos
        ttk.Label(self.tab1, text='Transpõe processos copiados na memória',
                  style='Title.TLabel').pack(pady=3)
        self.bt_transp_procs = tk.Button(self.tab1, style_button, text='Gera relação transposta',
                                         command=self.transpoe_clipboard)
        self.bt_transp_procs.pack()
        tt.ToolTip(self.bt_transp_procs, f'Transpõe a relação de processos copiados na memória para ser colada'
                                         f' no e-Processo')
        ttk.Separator(self.tab1, orient=tk.HORIZONTAL).pack(fill=tk.X, padx=8, pady=3)

        # Abre funcionalidades
        ttk.Label(self.tab1, text='Abre funções / processos', style='Title.TLabel').pack(pady=3)
        self.bt_abre_cx_trab = tk.Button(self.tab1, style_button, text='Abre e-Processo',
                                         command=self.abre_e_processo)
        self.bt_abre_cx_trab.pack()
        tt.ToolTip(self.bt_abre_cx_trab, 'Abre a tela de login para o e-Processo')

        self.bt_abre_cx_trab_antiga = tk.Button(self.tab1, style_button, text='Abre Caixa de Trabalho',
                                                command=self.abre_caixa_trabalho)
        self.bt_abre_cx_trab_antiga.pack()
        tt.ToolTip(self.bt_abre_cx_trab_antiga, 'Abre a caixa de trabalho de equipe no e-Processo')

        self.bt_abre_ger = tk.Button(self.tab1, style_button, text='Abre Gerencial de Estoque',
                                     command=self.abre_gerencial_estoque)
        self.bt_abre_ger.pack()
        tt.ToolTip(self.bt_abre_ger, 'Abre o gerencial de estoque de processos do e-Processo')

        self.bt_abre_consulta = tk.Button(self.tab1, style_button, text='Abre Consulta',
                                          command=self.abre_consulta)
        self.bt_abre_consulta.pack()
        tt.ToolTip(self.bt_abre_consulta, 'Abre a consulta de processos do e-Processo')

        self.bt_abre_triagem = tk.Button(self.tab1, style_button, text='Gera Relatório de Triagem do Secop 09',
                                          command=self.abre_triag)
        self.bt_abre_triagem.pack()
        tt.ToolTip(self.bt_abre_triagem, 'Gera o relatório de Triagem do Secop 09')

        self.bt_abre_triagem_SECOP = tk.Button(self.tab1, style_button, text='Gera Relatório Equipe TRIAGEM/SECOP 09',
                                         command=self.abre_triagem)
        self.bt_abre_triagem_SECOP.pack()
        tt.ToolTip(self.bt_abre_triagem_SECOP, 'Recupera os processos em análise manual na equipe TRIAGEM do Secop 09')

        self.bt_abre_procs = tk.Button(self.tab1, style_button, text='Abre processos copiados na área de transferência',
                                       command=self.abre_processos)
        self.bt_abre_procs.pack()
        tt.ToolTip(self.bt_abre_procs, 'Abre os processos os copiados na memória no e-Processo')

        self.bt_abre_palavras_chave = tk.Button(self.tab1, style_button, text='Abre palavras-chave dos processos copiados',
                                       command=self.abre_palavras_chave)
        self.bt_abre_palavras_chave.pack()
        tt.ToolTip(self.bt_abre_palavras_chave, 'Abre palavras-chave dos processos copiados na memória')

        self.frame_link = tk.Frame(self.tab1, width=35, bg='gray')
        self.frame_link.pack()

        self.bt_abre_via_cpf = tk.Button(self.frame_link, style_button_2, text='Abre VIA - CPF',
                                       command=self.abre_via_cpf)
        self.bt_abre_via_cpf.grid(row=0, column=0, sticky='we')
        tt.ToolTip(self.bt_abre_via_cpf, 'Abre o VIA para consulta a CPF')

        self.bt_abre_via_cnpj = tk.Button(self.frame_link, style_button_2, text='Abre VIA - CNPJ',
                                       command=self.abre_via_cnpj)
        self.bt_abre_via_cnpj.grid(row=0, column=1, sticky='we')
        tt.ToolTip(self.bt_abre_via_cnpj, 'Abre o VIA para consulta a CNPJ')

        ttk.Separator(self.tab1, orient=tk.HORIZONTAL).pack(fill=tk.X, padx=8, pady=3)

        # Text de saida
        self.texto_saida = tk.Text(self.master, width=45, height=8, bg='#33425c', fg='orange', font='Courier 9',
                                   wrap=tk.WORD)
        self.texto_saida.pack(pady=5)
        # self.texto_saida.grid(row=26, columnspan=4, padx=10, pady=5, sticky=tk.EW)
        # self.texto_saida.bind('<Escape>', self.exit)  # com um Esc encera o programa
        self.texto_nota.focus()

        # tab1a
        # Limpa csv
        ttk.Label(self.tab1a, text='Limpa arquivo .csv', style='Title.TLabel').pack(pady=3)
        self.frame_csv = tk.Frame(self.tab1a, width=48, bg='gray')
        self.frame_csv.pack()
        self.radio_csv_virgula = tk.Radiobutton(self.frame_csv, style_radio, text='Separador = ","',
                                                variable=self.radio_csv_var,
                                                value=1, width=17)
        self.radio_csv_virgula.grid(row=1, column=0, padx=4, pady=3, sticky='we')
        tt.ToolTip(self.radio_csv_virgula, 'Usa vírgula como separador de colunas')
        self.radio_csv_pontovirgula = tk.Radiobutton(self.frame_csv, style_radio, text='Separador = ";"',
                                                     variable=self.radio_csv_var, value=2, width=17)
        self.radio_csv_pontovirgula.grid(row=1, column=1, padx=4, pady=3, sticky='we')
        tt.ToolTip(self.radio_csv_pontovirgula, 'Usa ponto e vírgula como separador de colunas')
        self.radio_csv_virgula.select()
        self.run_cvs = tk.Button(self.tab1a, style_button, text='Selecionar o arquivo e executar',
                                 command=self.roda_csv)
        self.run_cvs.pack()
        tt.ToolTip(self.run_cvs, 'Processa a remoção de caracteres inválidos no arquivo .csv selecionado')
        ttk.Separator(self.tab1a, orient=tk.HORIZONTAL).pack(fill=tk.X, padx=8, pady=3)

        # Backup
        ttk.Label(self.tab1a, text='Backup de dirétório para .zip', style='Title.TLabel').pack(pady=3)
        self.run_bk = tk.Button(self.tab1a, style_button, text='Selecionar o diretório e executar',
                                command=self.roda_bk)
        self.run_bk.pack()
        tt.ToolTip(self.run_bk, 'Faz o backup de todo o conteúdo de um diretório para um arquivo .zip')
        ttk.Separator(self.tab1a, orient=tk.HORIZONTAL).pack(fill=tk.X, padx=8, pady=3)

        # Concatena pdf
        ttk.Label(self.tab1a, text='Concatenação de arquivos .pdf', style='Title.TLabel').pack(pady=3)
        self.run_pdf = tk.Button(self.tab1a, style_button, text='Selecionar o diretório e executar',
                                command=self.roda_pdf)
        self.run_pdf.pack()
        tt.ToolTip(self.run_pdf, 'Concatena os arquivos pdf de um diretório em um único arquivo.')
        ttk.Separator(self.tab1a, orient=tk.HORIZONTAL).pack(fill=tk.X, padx=8, pady=3)

        # tab2
        # Google
        ttk.Label(self.tab2, text='Google', style='Title.TLabel').pack(pady=3)
        self.frame_google = tk.Frame(self.tab2, width=48, bg='gray')
        self.frame_google.pack()
        self.radio_google_rfb = tk.Radiobutton(self.frame_google, style_radio, text="Google RFB",
                                               variable=self.radio_google_var,
                                               value=1, width=17)
        self.radio_google_rfb.grid(row=1, column=0, padx=4, pady=3, sticky='we')
        tt.ToolTip(self.radio_google_rfb, 'Pesquisa termo no site da RFB usando o Google')
        self.radio_map_it = tk.Radiobutton(self.frame_google, style_radio, text='Maps', variable=self.radio_google_var,
                                           value=2, width=17)
        self.radio_map_it.grid(row=1, column=1, padx=4, pady=3, sticky='we')
        tt.ToolTip(self.radio_map_it, 'Pesquisa enderenço no Google Maps')
        self.entry_gm = tk.Entry(self.tab2, style_entry)
        self.entry_gm.pack()
        self.entry_gm.bind('<Return>', self.roda_google)
        self.radio_google_rfb.select()
        self.run_gm = tk.Button(self.tab2, style_button, text='Pesquisa', command=self.roda_google)
        self.run_gm.pack()
        tt.ToolTip(self.run_gm, 'Aciona a consulta do termo ou endereço para a opção selecionada (Google RFB ou Maps)')
        ttk.Separator(self.tab2, orient=tk.HORIZONTAL).pack(fill=tk.X, padx=8, pady=3)

        # Calcula DV
        ttk.Label(self.tab2, text='Cálculo de dígitos verificadores',
                  style='Title.TLabel').pack(pady=3)
        self.frame_dv = tk.Frame(self.tab2, width=48, bg='gray')
        self.frame_dv.pack()
        self.radio_cpf = tk.Radiobutton(self.frame_dv, style_radio, text="Cpf", variable=self.radio_dv_var, value=1,
                                        width=8)
        self.radio_cpf.grid(row=0, column=0, padx=3, sticky='we', pady=2)
        self.radio_cnpj = tk.Radiobutton(self.frame_dv, style_radio, text="Cnpj", variable=self.radio_dv_var, value=2,
                                         width=8)
        self.radio_cnpj.grid(row=0, column=1, padx=3, sticky='we', pady=2)
        self.radio_proc_novo = tk.Radiobutton(self.frame_dv, style_radio, text="Proc. /0000",
                                              variable=self.radio_dv_var,
                                              value=3, width=8)
        self.radio_proc_novo.grid(row=0, column=2, padx=3, sticky='we', pady=2)
        self.radio_proc_antigo = tk.Radiobutton(self.frame_dv, style_radio, text="Proc. /00",
                                                variable=self.radio_dv_var,
                                                value=4, width=8)
        self.radio_proc_antigo.grid(row=0, column=3, padx=3, sticky='we', pady=2)
        self.radio_cpf.select()
        self.entry_dv = tk.Entry(self.tab2, style_entry)
        self.entry_dv.pack()
        self.entry_dv.bind('<Return>', self.calc_dv)
        self.entry_dv.bind('<KP_Enter>', self.calc_dv)
        self.run_dv = tk.Button(self.tab2, style_button, text='Calcula', command=self.calc_dv)
        self.run_dv.pack()
        tt.ToolTip(self.run_dv, 'Calcula ou valida os DV de CPF, CNPJ ou Processo (com ano de 4 e 2 dígitos).')
        ttk.Separator(self.tab2, orient=tk.HORIZONTAL).pack(fill=tk.X, padx=8, pady=3)

        # Formata Texto
        ttk.Label(self.tab2, text='Formata texto',
                  style='Title.TLabel').pack(pady=3)
        self.frame_form = tk.Frame(self.tab2, width=48, bg='gray')
        self.frame_form.pack()
        self.radio_maiusculo = tk.Radiobutton(self.frame_form, style_radio, text="XXXX", variable=self.radio_form_var,
                                              value=1, width=8)
        self.radio_maiusculo.grid(row=0, column=0, padx=3, sticky='we', pady=2)
        self.radio_minusculo = tk.Radiobutton(self.frame_form, style_radio, text="xxxx", variable=self.radio_form_var,
                                              value=2, width=8)
        self.radio_minusculo.grid(row=0, column=1, padx=3, sticky='we', pady=2)
        self.radio_title = tk.Radiobutton(self.frame_form, style_radio, text="Xxxx", variable=self.radio_form_var,
                                          value=3, width=8)
        self.radio_title.grid(row=0, column=2, padx=3, sticky='we', pady=2)
        self.radio_inverso = tk.Radiobutton(self.frame_form, style_radio, text="X<>x", variable=self.radio_form_var,
                                            value=4, width=8)
        self.radio_inverso.grid(row=0, column=3, padx=3, sticky='we', pady=2)
        self.radio_maiusculo.select()
        self.entry_form = tk.Entry(self.tab2, style_entry)
        self.entry_form.pack()
        self.entry_form.bind('<Return>', self.formata_txt)
        self.entry_form.bind('<KP_Enter>', self.formata_txt)
        self.run_dv = tk.Button(self.tab2, style_button, text='Formata', command=self.formata_txt)
        self.run_dv.pack()
        tt.ToolTip(self.run_dv, 'Formata o texto em maiúsculas, minúsculas, nome próprio ou caixa invertida.')
        ttk.Separator(self.tab2, orient=tk.HORIZONTAL).pack(fill=tk.X, padx=8, pady=3)

        self.define_raiz()
  def __init__(self, parent, settings, **kwargs):
    """Constructor for MainMenu

    arguments:
      parent - The parent widget
      settings - a dict containing Tkinter variables
    """
    super().__init__(parent, **kwargs)
    self.settings = settings
    self._create_icons()

    # Styles
    self.styles = {
      'background': '#333',
      'foreground': 'white',
      'activebackground': '#777',
      'activeforeground': 'white',
      'relief': tk.GROOVE
    }
    self.configure(**self.styles)

    # The help menu
    help_menu = tk.Menu(self, tearoff=False, **self.styles)
    help_menu.add_command(
      label='About…',
      command=self.show_about,
      image=self.icons['about'],
      compound=tk.LEFT
    )

    # The file menu
    file_menu = tk.Menu(self, tearoff=False, **self.styles)
    file_menu.add_command(
      label="Select file…",
      command=self._event('<<FileSelect>>'),
      image=self.icons['file_open'],
      compound=tk.LEFT
    )

    file_menu.add_separator()
    file_menu.add_command(
      label="Quit",
      command=self._event('<<FileQuit>>'),
      image=self.icons['quit'],
      compound=tk.LEFT
    )

    # The options menu
    options_menu = tk.Menu(self, tearoff=False, **self.styles)
    options_menu.add_checkbutton(
      label='Autofill Date',
      variable=self.settings['autofill date']
    )
    options_menu.add_checkbutton(
      label='Autofill Sheet data',
      variable=self.settings['autofill sheet data']
    )

    size_menu = tk.Menu(options_menu, tearoff=False, **self.styles)
    options_menu.add_cascade(label='Font Size', menu=size_menu)
    for size in range(6, 17, 1):
      size_menu.add_radiobutton(
        label=size, value=size,
        variable=self.settings['font size']
      )
    family_menu = tk.Menu(options_menu, tearoff=False, **self.styles)
    options_menu.add_cascade(label='Font Family', menu=family_menu)
    for family in font.families():
      family_menu.add_radiobutton(
        label=family, value=family,
        variable=self.settings['font family']
      )

    style = ttk.Style()
    themes_menu = tk.Menu(self, tearoff=False, **self.styles)
    for theme in style.theme_names():
      themes_menu.add_radiobutton(
        label=theme, value=theme,
        variable=self.settings['theme']
      )
    options_menu.add_cascade(label='Theme', menu=themes_menu)
    self.settings['theme'].trace_add('write', self._on_theme_change)


    # switch from recordlist to recordform
    go_menu = tk.Menu(self, tearoff=False, **self.styles)
    go_menu.add_command(
      label="Record List",
      command=self._event('<<ShowRecordlist>>'),
      image=self.icons['record_list'],
      compound=tk.LEFT
    )
    go_menu.add_command(
      label="New Record",
      command=self._event('<<NewRecord>>'),
      image=self.icons['new_record'],
      compound=tk.LEFT
    )

    # add the menus in order to the main menu
    self.add_cascade(label='File', menu=file_menu)
    self.add_cascade(label='Go', menu=go_menu)
    self.add_cascade(label='Options', menu=options_menu)
    self.add_cascade(label='Help', menu=help_menu)
示例#20
0
    def QuizSummary(self, win):
        win.destroy()
        summary_page = tk.ThemedTk()
        summary_page.geometry("1200x325")
        summary_page.wm_title(self.quiz_name + ": " +
                              str(len(self.individual_quiz) + 1) +
                              " Questions")

        summary_page.get_themes()
        summary_page.set_theme("radiance")

        list_of_lists = []

        style = ttk.Style()
        style.configure("mystyle.Treeview",
                        highlightthickness=0,
                        bd=0,
                        font=('Calibri', 12))  # Modify the font of the body
        style.configure("mystyle.Treeview.Heading",
                        font=('Calibri', 14,
                              'bold'))  # Modify the font of the headings
        #style.layout("mystyle.Treeview", [('mystyle.Treeview.treearea', {'sticky': 'nswe'})]) # Remove the borders

        q_entry = ttk.Entry(summary_page, width=25)
        q_entry.grid(row=2, column=0, padx=6)
        a_entry = ttk.Entry(summary_page, width=25)
        a_entry.grid(row=2, column=1, padx=6)
        m_entry = ttk.Entry(summary_page, width=25)
        m_entry.grid(row=2, column=2, padx=6)
        t_entry = ttk.Entry(summary_page, width=25)
        t_entry.grid(row=2, column=3, padx=6)
        h_entry = ttk.Entry(summary_page, width=25)
        h_entry.grid(row=2, column=4, padx=6)
        i_entry = ttk.Entry(summary_page, width=25)
        i_entry.grid(row=2, column=5, padx=6)

        #style.theme_use("aqua")
        tree = ttk.Treeview(summary_page,
                            columns=("Question", "Answer", "Marks", "Topic",
                                     "Hint", "Image"),
                            style="mystyle.Treeview")
        tree.grid(row=3, column=0, rowspan=2, columnspan=9, padx=10, pady=10)
        tree.heading('#0', text='Question')
        tree.heading('#1', text='Answer')
        tree.heading('#2', text='Marks')
        tree.heading('#3', text='Topic')
        tree.heading('#4', text='Hint')
        tree.heading('#5', text='Image')
        tree.column("#0", width=200)
        tree.column("#1", width=200)
        tree.column("#2", width=80)
        tree.column("#3", width=170)
        tree.column("#4", width=200)
        tree.column("#5", width=200)
        tree.column("#6", width=0)

        vertical_sb = ttk.Scrollbar(summary_page,
                                    orient="vertical",
                                    command=tree.yview)
        vertical_sb.grid(row=4, column=10, padx=5)
        tree.configure(yscrollcommand=vertical_sb.set)

        def get_selected_row(event):
            item = tree.selection()[0]
            self.value = tree.item(item, "values")
            self.question_selected = tree.item(item, "text")
            q_entry.delete(0, END)
            q_entry.insert(END, self.question_selected)

            a_entry.delete(0, END)
            a_entry.insert(END, self.value[0])

            m_entry.delete(0, END)
            m_entry.insert(END, self.value[1])

            t_entry.delete(0, END)
            t_entry.insert(END, self.value[2])

            h_entry.delete(0, END)
            h_entry.insert(END, self.value[3])

            i_entry.delete(0, END)
            i_entry.insert(END, self.value[4])

        tree.bind("<ButtonRelease-1>", get_selected_row)

        for questions in range(0, len(self.individual_quiz)):
            tree.insert("",
                        "end",
                        text=self.individual_quiz[questions][1],
                        values=(self.individual_quiz[questions][3],
                                self.individual_quiz[questions][2],
                                self.individual_quiz[questions][-1],
                                self.individual_quiz[questions][4],
                                self.individual_quiz[questions][6]))

        confirm_b = ttk.Button(
            summary_page,
            text="Confirm",
            width=14,
            command=lambda: self.Confirm(summary_page)).grid(row=6, column=5)

        edit_b = ttk.Button(summary_page,
                            text="Edit",
                            width=20,
                            command=lambda: self.Edit_Question(
                                summary_page,
                                self.question_selected,
                                self.value[0],
                                self.value[1],
                                self.value[2],
                                self.value[3],
                                self.value[4],
                                q_entry.get(),
                                a_entry.get(),
                                m_entry.get(),
                                t_entry.get(),
                                h_entry.get(),
                                i_entry.get(),
                            )).grid(row=6, column=3)

        delete_b = ttk.Button(
            summary_page,
            text="Delete",
            width=14,
            command=lambda: self.Delete_Question(
                summary_page, self.question_selected, self.value[0], self.
                value[1], self.value[2], self.value[3], self.value[4])).grid(
                    row=6, column=1)

        summary_page.mainloop()
示例#21
0
文件: Main.py 项目: J3Cs/Tarea2Ans
from tkinter import ttk
from tkinter import messagebox
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, NavigationToolbar2Tk
from matplotlib.figure import Figure
import matplotlib.pyplot as plt
import numpy as np
import sympy as sym
from sympy import *
import re
from modulos import bairstown, Biseccion, Falsa_posicion, muller, Newton, Secante, Tartaglia

# create main window
master = tkinter.Tk()
master.title("ANS135")
master.configure(bg="#212121")
cmbStyle = ttk.Style()
cmbStyle.theme_create('cmbs',settings = {'TCombobox':
                                     {'configure':
                                      {'selectbackground': '#607D8B',
                                       'fieldbackground': '#673AB7',
                                       'background': '#757575',
                                       'foreground': '#ffffff'
                                       }}})
cmbStyle.theme_use('cmbs')


#Frames para ordenar los componentes
frameEntries = tkinter.Frame(master,bg="#212121")
frameEntries.grid(row=0, column=1, columnspan=2)
frGrafica = tkinter.Frame(master,bg="#212121")
frGrafica.grid(row=0, column=0, rowspan=5)
示例#22
0
 def set_styles():
     """ Set global custom styles """
     gui_style = ttk.Style()
     gui_style.configure('TLabelframe.Label',
                         foreground="#0046D5",
                         relief=tk.SOLID)
示例#23
0
import tkinter.ttk as ttk
from tkinter.font import Font
from tkinter import messagebox
from tkinter import *
import sudoku_resevanje as sudoku_resevanje

root = Tk()
style = ttk.Style()
style.theme_use('clam')
root.option_add("*Font", ("comic sans MS", 9))
root.title('Sudoku')
root.geometry('255x310')

okvir0 = Frame(root)
okvir0.grid(row=0, column=0, sticky='w')
napis00 = Label(
    root,
    text='Vpiši številke v sudoku. \nKo končaš pritisni gumb \'Zaženi!\'',
    justify=LEFT)
napis00.grid(row=0,
             column=0,
             sticky='w',
             columnspan=3,
             padx=(7, 0),
             pady=(10, 0))

okvir1 = Frame(root)
okvir1.grid(row=1, column=0, sticky='w', padx=(10, 0), pady=(10, 0))
vnos1 = Entry(okvir1, width=3)
vnos1.grid(row=0, column=0, sticky='w')
vnos2 = Entry(okvir1, width=3)
import tkinter as tk
from tkinter import ttk
import tkinter.font as font

try:
    from ctypes import windll
    windll.shcore.SetProcessDpiAwareness(1)
except ModuleNotFoundError:
    pass

root = tk.Tk()

style = ttk.Style(root)
print(font.families())

# warninge_label_font = font.Font(family='Helvetica', size=14, weight='bold')
warninge_label_font = font.nametofont('TkDefaultFont').copy(
)  # Se não tiver o copy, mudará tudo pois TkDefaultFont mudaria
warninge_label_font.configure(family='Helvetica', size=14, weight='bold')

name = ttk.Label(root, text='Hello, world!', font=warninge_label_font)
entry = ttk.Entry(root, width=15)
button = ttk.Button(root, text='Press me.')
name.pack()
entry.pack()
button.pack()

root.mainloop()
示例#25
0
    b9.config(text=" ")
    b9.state(['!disabled'])


def Restart():
    global p1, p2, mov, ActivePlayer
    p1.clear()
    p2.clear()
    mov, ActivePlayer = 0, 1
    root.title("Tic Tac Toe : Player 1")
    EnableAll()


root = Tk()
root.title("Tic Tac toe : Player 1")
st = ttk.Style()
st.configure("my.TButton", font=('Chiller', 24, 'bold'))

b1 = ttk.Button(root, text=" ", style="my.TButton")
b1.grid(row=1, column=0, sticky="nwse", ipadx=50, ipady=50)
b1.config(command=lambda: ButtonClick(1))

b2 = ttk.Button(root, text=" ", style="my.TButton")
b2.grid(row=1, column=1, sticky="snew", ipadx=50, ipady=50)
b2.config(command=lambda: ButtonClick(2))

b3 = ttk.Button(root, text=" ", style="my.TButton")
b3.grid(row=1, column=2, sticky="snew", ipadx=50, ipady=50)
b3.config(command=lambda: ButtonClick(3))

b4 = ttk.Button(root, text=" ", style="my.TButton")
    def __init__(self, top=None):
        '''This class configures and populates the toplevel window.
           top is the toplevel containing window.'''
        _bgcolor = '#d9d9d9'  # X11 color: 'gray85'
        _fgcolor = '#000000'  # X11 color: 'black'
        _compcolor = '#d9d9d9'  # X11 color: 'gray85'
        _ana1color = '#d9d9d9'  # X11 color: 'gray85'
        _ana2color = '#ececec'  # Closest X11 color: 'gray92'
        font11 = "-family {Avenir Next Cyr Medium} -size 23 -weight "  \
            "normal -slant roman -underline 0 -overstrike 0"
        font12 = "-family {Avenir Next Cyr} -size 9 -weight bold "  \
            "-slant roman -underline 0 -overstrike 0"
        font13 = "-family {Gabriola} -size 22 -weight " \
                 "bold -slant roman -underline 0 -overstrike 0"
        self.style = ttk.Style()
        if sys.platform == "win32":
            self.style.theme_use('winnative')
        self.style.configure('.', background=_bgcolor)
        self.style.configure('.', foreground=_fgcolor)
        self.style.configure('.', font="TkDefaultFont")
        self.style.map('.',
                       background=[('selected', _compcolor),
                                   ('active', _ana2color)])

        top.geometry("687x526+558+155")
        top.title("New Toplevel")
        top.configure(background="#fff")
        self.top = top
        self.songName = tk.Label(top)
        self.songName.place(relx=0.437, rely=0.038, height=44, width=281)
        self.songName.configure(background="#fff")
        self.songName.configure(disabledforeground="#a3a3a3")
        self.songName.configure(font=font13)
        self.songName.configure(foreground="#000000")
        self.songName.configure(text=''' MUZIKKA APP ''')

        self.songProgress = ttk.Progressbar(top)
        self.songProgress.place(relx=0.393,
                                rely=0.209,
                                relwidth=0.495,
                                relheight=0.0,
                                height=7)

        self.songTotalDuration = ttk.Label(top)
        self.songTotalDuration.place(relx=0.844,
                                     rely=0.171,
                                     height=19,
                                     width=29)

        self.songTotalDuration.configure(background="#fff")
        self.songTotalDuration.configure(foreground="#3399ff")
        self.songTotalDuration.configure(font=font12)
        self.songTotalDuration.configure(relief='flat')

        self.songTimePassed = ttk.Label(top)
        self.songTimePassed.place(relx=0.393, rely=0.171, height=19, width=29)
        self.songTimePassed.configure(background="#ffffff")
        self.songTimePassed.configure(foreground="#000000")
        self.songTimePassed.configure(font=font12)
        self.songTimePassed.configure(relief='flat')

        self.pauseButton = tk.Button(top)
        self.pauseButton.place(relx=0.568, rely=0.266, height=34, width=34)
        self.pauseButton.configure(activebackground="#ececec")
        self.pauseButton.configure(activeforeground="#000000")
        self.pauseButton.configure(background="#fff")
        self.pauseButton.configure(borderwidth="0")
        self.pauseButton.configure(disabledforeground="#a3a3a3")
        self.pauseButton.configure(foreground="#000000")
        self.pauseButton.configure(highlightbackground="#d9d9d9")
        self.pauseButton.configure(highlightcolor="black")
        self._img1 = tk.PhotoImage(file="./icons/pause.png")
        self.pauseButton.configure(image=self._img1)
        self.pauseButton.configure(pady="0")
        self.pauseButton.configure(text='''Button''')

        self.playButton = tk.Button(top)
        self.playButton.place(relx=0.64, rely=0.266, height=34, width=34)
        self.playButton.configure(activebackground="#ececec")
        self.playButton.configure(activeforeground="#000000")
        self.playButton.configure(background="#fff")
        self.playButton.configure(borderwidth="0")
        self.playButton.configure(disabledforeground="#a3a3a3")
        self.playButton.configure(foreground="#000000")
        self.playButton.configure(highlightbackground="#d9d9d9")
        self.playButton.configure(highlightcolor="black")
        self._img2 = tk.PhotoImage(file="./icons/play.png")
        self.playButton.configure(image=self._img2)
        self.playButton.configure(pady="0")
        self.playButton.configure(text='''Button''')

        self.stopButton = tk.Button(top)
        self.stopButton.place(relx=0.713, rely=0.266, height=34, width=34)
        self.stopButton.configure(activebackground="#ececec")
        self.stopButton.configure(activeforeground="#000000")
        self.stopButton.configure(background="#fff")
        self.stopButton.configure(borderwidth="0")
        self.stopButton.configure(disabledforeground="#a3a3a3")
        self.stopButton.configure(foreground="#000000")
        self.stopButton.configure(highlightbackground="#d9d9d9")
        self.stopButton.configure(highlightcolor="black")
        self._img3 = tk.PhotoImage(file="./icons/stop.png")
        self.stopButton.configure(image=self._img3)
        self.stopButton.configure(pady="0")
        self.stopButton.configure(text='''Button''')

        self.vinylRecordImage = tk.Label(top)
        self.vinylRecordImage.place(relx=0.0, rely=0.0, height=204, width=204)
        self.vinylRecordImage.configure(background="#d9d9d9")
        self.vinylRecordImage.configure(disabledforeground="#a3a3a3")
        self.vinylRecordImage.configure(foreground="#000000")
        self._img4 = tk.PhotoImage(file="./icons/vinylrecord.png")
        self.vinylRecordImage.configure(image=self._img4)
        self.vinylRecordImage.configure(text='''Label''')

        self.playList = ScrolledListBox(top)
        self.playList.place(relx=0.0,
                            rely=0.38,
                            relheight=0.532,
                            relwidth=0.999)

        self.playList.configure(background="white")
        self.playList.configure(disabledforeground="#a3a3a3")
        self.playList.configure(font="TkFixedFont")
        self.playList.configure(foreground="black")
        self.playList.configure(highlightbackground="#d9d9d9")
        self.playList.configure(highlightcolor="#d9d9d9")
        self.playList.configure(selectbackground="#c4c4c4")
        self.playList.configure(selectforeground="black")
        self.playList.configure(width=10)

        self.previousButton = tk.Label(top)
        self.previousButton.place(relx=0.509, rely=0.285, height=16, width=16)
        self.previousButton.configure(background="#fff")
        self.previousButton.configure(borderwidth="0")
        self.previousButton.configure(disabledforeground="#a3a3a3")
        self.previousButton.configure(foreground="#000000")
        self._img5 = tk.PhotoImage(file="./icons/previous.png")
        self.previousButton.configure(image=self._img5)
        self.previousButton.configure(text='''Label''')

        self.bottomBar = ttk.Label(top)
        self.bottomBar.place(relx=0.0, rely=0.913, height=49, width=686)
        self.bottomBar.configure(background="#d9d9d9")
        self.bottomBar.configure(foreground="#000000")
        self.bottomBar.configure(font="TkDefaultFont")
        self.bottomBar.configure(relief='flat')
        self.bottomBar.configure(width=686)
        self.bottomBar.configure(state='disabled')

        self.vol_scale = ttk.Scale(top)
        self.vol_scale.place(relx=0.015,
                             rely=0.932,
                             relwidth=0.146,
                             relheight=0.0,
                             height=26,
                             bordermode='ignore')
        self.vol_scale.configure(takefocus="")

        self.addSongsToPlayListButton = tk.Button(top)
        self.addSongsToPlayListButton.place(relx=0.961,
                                            rely=0.323,
                                            height=17,
                                            width=17)
        self.addSongsToPlayListButton.configure(activebackground="#ececec")
        self.addSongsToPlayListButton.configure(activeforeground="#d9d9d9")
        self.addSongsToPlayListButton.configure(background="#fff")
        self.addSongsToPlayListButton.configure(borderwidth="0")
        self.addSongsToPlayListButton.configure(disabledforeground="#a3a3a3")
        self.addSongsToPlayListButton.configure(foreground="#000000")
        self.addSongsToPlayListButton.configure(highlightbackground="#d9d9d9")
        self.addSongsToPlayListButton.configure(highlightcolor="black")
        self._img6 = tk.PhotoImage(file="./icons/add.png")
        self.addSongsToPlayListButton.configure(image=self._img6)
        self.addSongsToPlayListButton.configure(pady="0")
        self.addSongsToPlayListButton.configure(text='''Button''')

        self.deleteSongsFromPlaylistButton = tk.Button(top)
        self.deleteSongsFromPlaylistButton.place(relx=0.917,
                                                 rely=0.323,
                                                 height=18,
                                                 width=18)
        self.deleteSongsFromPlaylistButton.configure(
            activebackground="#ececec")
        self.deleteSongsFromPlaylistButton.configure(
            activeforeground="#000000")
        self.deleteSongsFromPlaylistButton.configure(background="#fff")
        self.deleteSongsFromPlaylistButton.configure(borderwidth="0")
        self.deleteSongsFromPlaylistButton.configure(
            disabledforeground="#a3a3a3")
        self.deleteSongsFromPlaylistButton.configure(foreground="#000000")
        self.deleteSongsFromPlaylistButton.configure(
            highlightbackground="#d9d9d9")
        self.deleteSongsFromPlaylistButton.configure(highlightcolor="black")
        self._img7 = tk.PhotoImage(file="./icons/delete.png")
        self.deleteSongsFromPlaylistButton.configure(image=self._img7)
        self.deleteSongsFromPlaylistButton.configure(pady="0")
        self.deleteSongsFromPlaylistButton.configure(text='''Button''')

        self.Button9 = tk.Button(top)  # favourite button
        self.Button9.place(relx=0.932, rely=0.913, height=42, width=42)
        self.Button9.configure(activebackground="#ececec")
        self.Button9.configure(activeforeground="#000000")
        self.Button9.configure(background="#d9d9d9")
        self.Button9.configure(borderwidth="0")
        self.Button9.configure(disabledforeground="#a3a3a3")
        self.Button9.configure(foreground="#000000")
        self.Button9.configure(highlightbackground="#d9d9d9")
        self.Button9.configure(highlightcolor="black")
        self._img8 = tk.PhotoImage(file="./icons/like.png")
        self.Button9.configure(image=self._img8)
        self.Button9.configure(pady="0")
        self.Button9.configure(text='''Button''')
        self.Button9.configure(width=42)

        self.Button10 = tk.Button(top)  # button remove from favourites
        self.Button10.place(relx=0.873, rely=0.913, height=42, width=42)
        self.Button10.configure(activebackground="#ececec")
        self.Button10.configure(activeforeground="#000000")
        self.Button10.configure(background="#d9d9d9")
        self.Button10.configure(borderwidth="0")
        self.Button10.configure(disabledforeground="#a3a3a3")
        self.Button10.configure(foreground="#000000")
        self.Button10.configure(highlightbackground="#d9d9d9")
        self.Button10.configure(highlightcolor="black")
        self._img9 = tk.PhotoImage(file="./icons/broken-heart.png")
        self.Button10.configure(image=self._img9)
        self.Button10.configure(pady="0")
        self.Button10.configure(text='''Button''')
        self.Button10.configure(width=48)

        self.Button11 = tk.Button(top)  # refresh button
        self.Button11.place(relx=0.83, rely=0.932, height=26, width=26)
        self.Button11.configure(activebackground="#ececec")
        self.Button11.configure(activeforeground="#000000")
        self.Button11.configure(background="#d9d9d9")
        self.Button11.configure(borderwidth="0")
        self.Button11.configure(disabledforeground="#a3a3a3")
        self.Button11.configure(foreground="#000000")
        self.Button11.configure(highlightbackground="#d9d9d9")
        self.Button11.configure(highlightcolor="black")
        self._img10 = tk.PhotoImage(file="./icons/refresh.png")
        self.Button11.configure(image=self._img10)
        self.Button11.configure(pady="0")
        self.Button11.configure(text='''Button''')

        self.setup_player()
        self.isThreadRunning = False
示例#27
0
    def ClienteInterfaz():
        insertC = tk.Tk()

        # Declaracion de variables
        global enNombreC, enTelCasaC, enTelPerC, enCorreoPerC, enDirecC, enObservacionesC
        enNombreC = tk.StringVar()
        enTelCasaC = tk.IntVar()
        enTelPerC = tk.IntVar()
        enCorreoPerC = tk.StringVar()
        enDirecC = tk.StringVar()
        enObservacionesC = tk.StringVar()

        # Configuracion de la pantalla
        insertC.title('Insertar datos de Clientes')
        insertC.geometry('2000x2000')
        insertC.configure(bg='#17202A')

        # Insertarle etiquetas a la interfaz
        tk.Label(insertC, background='#566573', text='Nombre').place(x=10,
                                                                     y=20,
                                                                     width=200,
                                                                     height=20)
        tk.Label(insertC, background='#566573',
                 text='Telefono del la casa').place(x=10,
                                                    y=80,
                                                    width=200,
                                                    height=20)
        tk.Label(insertC, background='#566573',
                 text='Telefono personal').place(x=10,
                                                 y=140,
                                                 width=200,
                                                 height=20)
        tk.Label(insertC, background='#566573',
                 text='Direccion').place(x=10, y=200, width=200, height=20)
        tk.Label(insertC, background='#566573',
                 text='Correo electronico').place(x=10,
                                                  y=260,
                                                  width=200,
                                                  height=20)
        tk.Label(insertC, background='#566573',
                 text='Observaciones').place(x=10, y=320, width=200, height=20)
        tk.Label(insertC, background='#566573',
                 text='Taxista').place(x=10, y=380, width=200, height=20)

        # Con esta parte se puede insertar datos
        tk.Entry(insertC, background='#566573',
                 textvariable=enNombreC).place(x=50,
                                               y=50,
                                               width=400,
                                               height=20)
        tk.Entry(insertC, background='#566573',
                 textvariable=enTelCasaC).place(x=50,
                                                y=110,
                                                width=400,
                                                height=20)
        tk.Entry(insertC, background='#566573',
                 textvariable=enTelPerC).place(x=50,
                                               y=170,
                                               width=400,
                                               height=20)
        tk.Entry(insertC, background='#566573',
                 textvariable=enDirecC).place(x=50,
                                              y=230,
                                              width=400,
                                              height=20)
        tk.Entry(insertC, background='#566573',
                 textvariable=enCorreoPerC).place(x=50,
                                                  y=290,
                                                  width=400,
                                                  height=20)
        tk.Entry(insertC, background='#566573',
                 textvariable=enObservacionesC).place(x=50,
                                                      y=350,
                                                      width=400,
                                                      height=20)

        # Treview
        treeC = Treeview(insertC, height=10)
        treeC.place(x=500, y=20, width=700, height=350)

        treeC['columns'] = ("Clave", "Placa", "Nombre del conductor",
                            "Telefono del conductor")

        # Fomato de las columnas
        treeC.column('#0', width=0)
        treeC.column('Clave', width=100, anchor=tk.CENTER)
        treeC.column('Placa', width=100, anchor=tk.CENTER)
        treeC.column('Nombre del conductor', width=200, anchor=tk.CENTER)
        treeC.column('Telefono del conductor', width=200, anchor=tk.CENTER)

        # Create headings
        treeC.heading("#0", text="", anchor=tk.CENTER)
        treeC.heading('Clave', text="Clave", anchor=tk.CENTER)
        treeC.heading('Placa', text="Placa", anchor=tk.CENTER)
        treeC.heading('Nombre del conductor',
                      text="Nom. conductor",
                      anchor=tk.CENTER)
        treeC.heading('Telefono del conductor',
                      text="Telefono del conductor",
                      anchor=tk.CENTER)

        # Scrollbar
        scrollYC = Scrollbar(insertC, orient="vertical", command=treeC.yview)
        scrollYC.place(x=502, y=20, width=20, height=350)
        scrollYC.configure(command=treeC.yview)

        scrollXC = Scrollbar(insertC, orient="horizontal", command=treeC.xview)
        scrollXC.place(x=520, y=350, width=675, height=20)
        scrollXC.configure(command=treeC.xview)

        #Style
        styleC = ttk.Style(insertC)
        styleC.theme_use("alt")
        styleC.configure("Treeview",
                         background='#566573',
                         fieldbackground='#17202A',
                         foreground="black")

        styleC = ttk.Style(insertC)
        styleC.theme_use("alt")
        styleC.configure("Treeview.Heading",
                         background='#566573',
                         darkcolor="#17202A",
                         lightcolor="#566573",
                         troughcolor="#566573",
                         bordercolor="#17202A")

        styleS = ttk.Style(insertC)
        styleS.theme_use('alt')
        styleS.configure("Horizontal.TScrollbar",
                         gripcount=0,
                         background='#566573',
                         darkcolor="#17202A",
                         lightcolor="#566573",
                         troughcolor="#566573",
                         bordercolor="#17202A",
                         arrowcolor="#17202A")

        styleS = ttk.Style(insertC)
        styleS.theme_use('alt')
        styleS.configure("Vertical.TScrollbar",
                         gripcount=0,
                         background='#566573',
                         darkcolor="#17202A",
                         lightcolor="#566573",
                         troughcolor="#566573",
                         bordercolor="#17202A",
                         arrowcolor="#17202A")

        styleC = ttk.Style(insertC)
        styleC.theme_use("alt")
        styleC.configure("TCombobox",
                         background='#566573',
                         darkcolor="#17202A",
                         lightcolor="#566573",
                         troughcolor="#566573",
                         bordercolor="#17202A",
                         arrowcolor="#17202A")

        styleT = ttk.Style(insertC)
        styleT.theme_use('alt')
        styleT.configure("TCombobox",
                         background='#566573',
                         fieldbackground='#566573',
                         selectbackground='#566573')
        styleT.map('TCombobox', fieldbackground=[('readonly', '#566573')])
        insertC.option_add('*TCombobox*Listbox.background', '#566573')

        # Modulos
        Cliente.Ver_datosC(treeC)
        Cliente.SeleccionTaxistas(insertC)

        # Insertarle botones a la interfaz
        tk.Button(insertC,
                  background='#566573',
                  activeforeground='#2C3E50',
                  cursor="hand2",
                  text='Ingresar',
                  command=Cliente.Insertar_DatosC).place(x=300,
                                                         y=550,
                                                         width=200,
                                                         height=40)
        tk.Button(insertC,
                  background='#566573',
                  activeforeground='#2C3E50',
                  cursor="hand2",
                  text='Limpiar',
                  command=Cliente.Limpiar_EntryC).place(x=550,
                                                        y=550,
                                                        width=200,
                                                        height=40)
        tk.Button(insertC,
                  background='#566573',
                  activeforeground='#2C3E50',
                  cursor="hand2",
                  text='Regresar',
                  command=insertC.destroy).place(x=800,
                                                 y=550,
                                                 width=200,
                                                 height=40)
示例#28
0
 def __init__(self, master, widgets, **kw):
     self.widgets = widgets
     self.SortDir = True
     f = ttk.Frame(master)
     f.pack(fill=BOTH, expand=True)
     self.dataCols = ('Project Name', 'Status', 'Cores', 'Added date/time')
     self.tree = ttk.Treeview(columns=self.dataCols)
     self.mouse_event = None
     self.moved_flag = False
     self.img_container = {}
     self.popup_menu = Menu(master, tearoff=0)
     self.popup_menu.add_command(
         label="Delete", command=lambda: self.delete(self.mouse_event))
     self.popup_menu.add_command(
         label="Save",
         command=lambda: self.do_stop_process(self.mouse_event))
     self.popup_menu.add_command(
         label="Cancel",
         command=lambda: self.do_kill_process(self.mouse_event))
     # self.popup_menu.add_command(label="Pause",
     #                             command=lambda: self.do_pause_process(self.mouse_event))
     # self.popup_menu.add_command(label="Resume",
     #                             command=lambda: self.do_resume_process(self.mouse_event))
     self.tree.grid(in_=f, row=0, column=0, sticky=NSEW)
     self.tree.heading('#0', anchor='center')
     self.tree.heading('#1', text='Project Name', anchor='center')
     self.tree.heading('#2', text='Status', anchor='center')
     self.tree.heading('#3', text='Cores', anchor='center')
     self.tree.heading('#4', text='Added date/time', anchor='center')
     self.tree.column('#0', anchor='center', width=1)
     self.tree.column('#1', anchor='w')
     self.tree.column('#2', anchor='center')
     self.tree.column('#3', anchor='center')
     self.tree.column('#4', anchor='center')
     # set frame resize priorities
     f.rowconfigure(0, weight=1)
     f.columnconfigure(0, weight=1)
     style = ttk.Style()
     style.layout(
         "Treeview.Item",
         [(
             'Treeitem.padding',
             {
                 'sticky':
                 'nswe',
                 'children': [
                     ('Treeitem.indicator', {
                         'side': 'left',
                         'sticky': ''
                     }),
                     ('Treeitem.image', {
                         'side': 'left',
                         'sticky': ''
                     }),
                     # ('Treeitem.focus', {'side': 'left', 'sticky': '', 'children': [
                     ('Treeitem.text', {
                         'side': 'left',
                         'sticky': ''
                     }),
                     # ]})
                 ],
             })])
     style.configure('Treeview', rowheight=38)
     self._load_data()
     self.tree.bind('<Button-3>', self.on_right_click)
     self.tree.bind("<ButtonPress-1>", self.b_down)
     self.tree.bind("<ButtonRelease-1>", self.b_up, add='+')
     self.tree.bind("<B1-Motion>", self.b_move, add='+')
_root.resizable(width=False, height=False)

# Setup top frame.
_frame1 = ttk.Frame(_root, padding="10", relief='sunken')
_frame1.grid(column=0, row=0, sticky='news')
_frame1.grid_columnconfigure(0, weight=1, uniform="Label1Group")
_frame1.grid_columnconfigure(1, weight=1, uniform="Button1Group")
_frame1.grid_columnconfigure(2, weight=1, uniform="Comment1Group")
_frame1.grid_columnconfigure(3, weight=1, uniform="Label2Group")
_frame1.grid_columnconfigure(4, weight=1, uniform="Button2Group")
_frame1.grid_columnconfigure(5, weight=1, uniform="Comment2Group")
_frame1.columnconfigure(0, weight=1)
_frame1.rowconfigure(0, weight=1)

# Config style
s = ttk.Style()
s.configure('.',
            font=('Verdana', 8),
            bordercolor=_fg1,
            foreground=_fg1,
            background=_frame_bg1)
s.configure('Header1.TLabel', font=('Arial', 12, 'bold'), anchor='center')
s.configure('SubHeader1.TLabel', font=('Arial', 9, 'italic'), anchor='center')
s.configure('Header2.TLabel', font=('Arial', 10, 'bold'))
s.configure('Author.TLabel', font=('Arial', 8, 'italic'), foreground='black')
s.configure('Comment.TLabel', font=('Verdana', 8, 'italic'))
s.configure('C.TCheckbutton',
            font=('Verdana', 9),
            foreground=_fg1,
            background=_frame_bg1)
s.configure('Bot.TFrame', background=_frame_bg2)
示例#30
0
    def edit_window(self):
        '''Create window to enter source of spending'''

        for _var in self._vars:
            _var.set(0)

        self.master.title('Edit')
        self.add_earned_spent_frame.pack_forget()
        self.back_button_frame.place(x=10, y=10)
        self.edit_window_frame.pack(ipadx=900, ipady=500)
        self.back_button_button.config(
            command=lambda: self.back_button_command(
                self.add_earned_spent_frame, 'Add Earning | Expenditure'))

        self.edit_frame = Frame(self.edit_window_frame, bd=0)
        self.edit_image = PhotoImage(file='included files\\edit.png')
        self.edit_label_image = Label(self.edit_frame,
                                      image=self.edit_image,
                                      borderwidth=0,
                                      takefocus=False)
        self.edit_label_image.grid(row=0, column=0)
        self.edit_frame.place(x=80, y=120)

        self.m_frame = Frame(self.edit_window_frame,
                             bg='white',
                             height=250,
                             highlightthickness=1,
                             highlightbackground='silver')
        self.source_label = Label(self.m_frame,
                                  text='Source of Money',
                                  **self.label_attributes)
        self.source_entry_box = ttk.Entry(self.m_frame, width=50)
        self.source_label.grid(row=0, column=0)
        self.source_entry_box.grid(row=0, column=1)
        self.m_frame.place(x=300, y=80)

        self.new_source_label = Label(self.m_frame,
                                      text='New Source of Money',
                                      **self.label_attributes)
        self.new_source_entry_box = ttk.Entry(self.m_frame, width=50)
        self.new_source_label.grid(row=1, column=0)
        self.new_source_entry_box.grid(row=1, column=1)

        self.old_money_label = Label(self.m_frame,
                                     text='Old Amount',
                                     **self.label_attributes)
        self.old_money_entry = ttk.Entry(self.m_frame, width=50)
        self.old_money_label.grid(row=2, column=0)
        self.old_money_entry.grid(row=2, column=1, padx=10)

        self.new_money_label = Label(self.m_frame,
                                     text='New Amount',
                                     **self.label_attributes)
        self.new_money_entry = ttk.Entry(self.m_frame, width=50)
        self.new_money_label.grid(row=3, column=0)
        self.new_money_entry.grid(row=3, column=1, padx=10)

        self.var = IntVar()
        self.style = ttk.Style()
        self.style.configure('R.TRadiobutton',
                             background='white',
                             foreground='black')

        self.radio_button_frame = Frame(self.edit_window_frame, bg='white')
        self.save_radio_buttons = ttk.Radiobutton(self.radio_button_frame,
                                                  text='Saving',
                                                  value=1,
                                                  variable=self.var,
                                                  style='R.TRadiobutton',
                                                  cursor='hand2')
        self.spend_radio_buttons = ttk.Radiobutton(self.radio_button_frame,
                                                   text='Spending',
                                                   value=2,
                                                   variable=self.var,
                                                   style='R.TRadiobutton',
                                                   cursor='hand2')
        self.save_radio_buttons.grid(row=0, column=0)
        self.spend_radio_buttons.grid(row=0, column=1)
        self.radio_button_frame.place(x=720, y=320)

        self.append_button = Button(
            self.m_frame,
            height=3,
            width=16,
            fg='white',
            bg='#01912f',
            activebackground='#01912f',
            activeforeground='white',
            text='APPEND',
            font=self.font1,
            cursor='hand2',
            command=lambda: self.edit_command(
                self.source_entry_box, self.new_source_entry_box, self.
                old_money_entry, self.new_money_entry, self.var))
        self.append_button.grid(row=4, column=1, pady=11, padx=5, sticky='e')