コード例 #1
0
    def __init__(self, root):
        self.root = root
        self.root.title("EZEOS")
        self.root.geometry('980x700')

        try:
            import ttkthemes
            self.style = ttkthemes.ThemedStyle()
        except ModuleNotFoundError:
            self.style = ttk.Style()

        self.style.theme_use(THEME)

        # Add status bar
        self.status = StatusBar(self.root)
        self.status.pack(side=TOP, fill=X)
        self.setstatus(VERSION + " | " + CDT_VERSION)
        # Add menubar
        self.menuBar = MenuBar(self)

        # Add Tab panel
        self.tabPanel = TabPanel(self)
        # Add output panel
        self.outputPanel = OutputPanel(self)
        # Create Logger
        self.log = self.outputPanel.logger
        self.log(EZEOS)
コード例 #2
0
def run():
    root = tk.Tk()
    root.title(config.WINDOW_TITLE)
    root.style = ttkthemes.ThemedStyle()
    root.style.theme_use("equilux")
    root.geometry(display.SCREEN_DIMENSIONS)
    selector = Selector(root)
    root.mainloop()
コード例 #3
0
ファイル: main.py プロジェクト: dpk14/MassSpecAutomator
def run():
    root = tk.Tk()
    root.geometry("{0}x{1}+0+0".format(root.winfo_screenwidth(),
                                       root.winfo_screenheight()))
    root.title("Mass Spec Automator")
    root.style = ttkthemes.ThemedStyle()
    #print(ttkthemes.ThemedStyle().theme_names())
    root.style.theme_use("clearlooks")
    DisplayController(root)
    root.mainloop()
コード例 #4
0
ファイル: ttkthemes.py プロジェクト: rscales02/porcupine
def setup():
    style = ttkthemes.ThemedStyle()

    # https://github.com/RedFantom/ttkthemes/issues/6
    # this does what style.theme_use() should do
    default_theme = style.tk.eval('return $ttk::currentTheme')

    config.add_option('ttk_theme', default_theme, reset=False)
    config.connect('ttk_theme', functools.partial(on_theme_changed, style))
    actions.add_choice("Ttk Themes", sorted(style.get_themes()),
                       var=config.get_var('ttk_theme'))
コード例 #5
0
def setup() -> None:
    style = ttkthemes.ThemedStyle()

    # https://github.com/RedFantom/ttkthemes/issues/6
    # this does what style.theme_use() should do
    default_theme = style.tk.eval('return $ttk::currentTheme')
    settings.add_option('ttk_theme', default_theme)

    var = tkinter.StringVar()
    var.trace_add('write', functools.partial(on_theme_changed, style, var))
    var.set(settings.get('ttk_theme', str))
    for name in sorted(style.get_themes()):
        menubar.get_menu("Ttk Themes").add_radiobutton(label=name, value=name, variable=var)
コード例 #6
0
ファイル: ttk_themes.py プロジェクト: ThePhilgrim/porcupine
def setup() -> None:
    style = ttkthemes.ThemedStyle()
    settings.add_option("ttk_theme", style.theme_use())

    var = tkinter.StringVar()
    for name in sorted(style.get_themes()):
        menubar.get_menu("Ttk Themes").add_radiobutton(label=name, value=name, variable=var)

    # Connect style and var
    var.trace_add("write", lambda *junk: style.set_theme(var.get()))

    # Connect var and settings
    get_main_window().bind(
        "<<SettingChanged:ttk_theme>>",
        lambda event: var.set(settings.get("ttk_theme", str)),
        add=True,
    )
    var.set(settings.get("ttk_theme", str))
    var.trace_add("write", lambda *junk: settings.set_("ttk_theme", var.get()))
コード例 #7
0
def random_slideshow(photo_root=None, exclude=[]):
    config = Config.load()

    master = tk.Tk()
    master.style = ttkthemes.ThemedStyle()
    master.style.theme_use("equilux")
    hide_hidden_files(master)

    if photo_root is None:
        # Open dialog to select root
        photo_root = filedialog.askdirectory(
            initialdir=str(Path.home()),
            title="Select a root directory to search for photos")
        if not photo_root:
            print("No photo root given: exiting")
            return
    # Index collection in given dir
    photo_selector = PhotoSelector(photo_root, exclude)

    # Set up a slideshow
    Slideshow(master, photo_selector, config)
    master.focus_set()

    master.mainloop()
コード例 #8
0
def on_save():
    """Save current values to custom preset"""
    options['Custom'] = [val.get() for val in eq_sliders]
    presets.set('Custom')


# ------- Equalizer Window ---------

root = tk.Tk()
root.withdraw()  # hide the window until completely built
root.title('The Great Equalizer')
root.iconbitmap('eqicon.ico')
root.resizable(False, False)

# apply theme
style = ttkthemes.ThemedStyle()
style.theme_use('breeze')
style.configure('title.TLabel', font=('Broadway', 18))

# window frames to contain sliders & buttons
bframe = ttk.Frame(root)
sframe = ttk.Frame(root)
lframe = ttk.Frame(root)

# sliders
eq_names = ['Vol', '63', '125', '250', '500', '1k', '2k', '4k', '8k', '16k']
eq_sliders = [
    ttk.Scale(sframe,
              from_=0,
              to=100,
              value=50,
コード例 #9
0
    def __init__(self):
        super().__init__()
        self.title('File Search Engine')
        self.style = ttkthemes.ThemedStyle()
        self.style.theme_use('arc')
        self.withdraw()
        self.iconbitmap('icon.ico')
        self.wm_state('zoomed')
        self.platform = self.tk.call('tk', 'windowingsystem')

        # application variables
        self.search_type_var = tk.StringVar()
        self.search_term_var = tk.StringVar()
        self.search_path_var = tk.StringVar()

        # window frames
        self.frm_main = ttk.Frame(self, padding=10)
        self.frm_top = ttk.Frame(self.frm_main)
        self.frm_term = ttk.Frame(self.frm_top)
        self.frm_type = ttk.LabelFrame(self.frm_top, text='Type', padding=4)
        self.frm_path = ttk.Frame(self.frm_top)

        # search path input
        self.path_lbl = ttk.Label(self.frm_path, text='Path', width=6)
        self.path_entry = ttk.Entry(self.frm_path,
                                    textvariable=self.search_path_var,
                                    width=60)

        # search term input
        self.term_lbl = ttk.Label(self.frm_term, text='Term', width=6)
        self.term_entry = ttk.Entry(self.frm_term,
                                    textvariable=self.search_term_var,
                                    width=60)
        self.term_entry.focus()

        # search type selection
        self.type_contains = ttk.Radiobutton(self.frm_type,
                                             text='Contains',
                                             value='contains',
                                             variable=self.search_type_var)
        self.type_startswith = ttk.Radiobutton(self.frm_type,
                                               text='StartsWith',
                                               value='startswith',
                                               variable=self.search_type_var)
        self.type_endswith = ttk.Radiobutton(self.frm_type,
                                             text='EndsWith',
                                             value='endswith',
                                             variable=self.search_type_var)

        # form buttons
        self.btn_browse = ttk.Button(self.frm_top,
                                     text='Browse',
                                     command=self.on_browse)
        self.btn_search = ttk.Button(self.frm_top,
                                     text='Search',
                                     command=self.on_search)

        # search results tree
        self.tree = ttk.Treeview(self.frm_main)
        self.tree['columns'] = ('modified', 'type', 'size', 'path')
        self.tree.column('#0', width=400)
        self.tree.column('modified', width=150, stretch=False, anchor=tk.E)
        self.tree.column('type', width=50, stretch=False, anchor=tk.E)
        self.tree.column('size', width=50, stretch=False, anchor=tk.E)
        self.tree.heading('#0', text='Name')
        self.tree.heading('modified', text='Modified date')
        self.tree.heading('type', text='Type')
        self.tree.heading('size', text='Size')
        self.tree.heading('path', text='Path')

        # progress bar
        self.prog_bar = ttk.Progressbar(self.frm_main,
                                        orient=tk.HORIZONTAL,
                                        mode='indeterminate')

        # right-click menu for treeview
        self.menu = tk.Menu(self, tearoff=False)
        self.menu.add_command(label='Reveal in file manager',
                              command=self.on_doubleclick_tree)
        self.menu.add_command(label='Export results to csv',
                              command=self.export_to_csv)

        # add widgets to window
        self.frm_top.pack(side=tk.TOP, fill=tk.X)
        self.frm_path.grid(row=0, column=0, padx=4, pady=2, sticky=tk.NSEW)
        self.path_lbl.pack(side=tk.LEFT)
        self.path_entry.pack(side=tk.LEFT, fill=tk.BOTH, expand=tk.YES)
        self.btn_browse.grid(row=0, column=1, padx=4, pady=2, sticky=tk.NSEW)
        self.frm_term.grid(row=1, column=0, padx=4, pady=2, sticky=tk.NSEW)
        self.term_lbl.pack(side=tk.LEFT, )
        self.term_entry.pack(side=tk.LEFT, fill=tk.BOTH, expand=tk.YES)
        self.btn_search.grid(row=1, column=1, padx=4, pady=2, sticky=tk.NSEW)
        self.frm_type.grid(row=0,
                           column=2,
                           rowspan=2,
                           padx=4,
                           pady=2,
                           sticky=tk.NSEW)
        self.type_contains.grid(row=0, column=0, sticky=tk.W)
        self.type_startswith.grid(row=2, column=0, sticky=tk.W)
        self.type_endswith.grid(row=1, column=0, sticky=tk.W)
        self.tree.pack(side=tk.TOP,
                       padx=4,
                       pady=4,
                       fill=tk.BOTH,
                       expand=tk.YES)
        self.prog_bar.pack(side=tk.TOP, padx=5, pady=2, fill=tk.X)
        self.frm_main.pack(fill=tk.BOTH, expand=tk.YES)

        # event binding
        self.tree.bind('<Double-1>', self.on_doubleclick_tree)

        if self.platform == 'aqua':
            self.tree.bind('<2>', self.right_click_tree)
            self.tree.bind('<Control-1>', self.right_click_tree)
        else:
            self.tree.bind('<3>', self.right_click_tree)

        # intial settings
        self.search_type_var.set('contains')
        self.search_path_var.set(pathlib.os.getcwd())
        self.search_count = 0
        self.deiconify()
コード例 #10
0
    def __init__(self, master):
        host = socket.gethostname()
        global ipaddress
        ipaddress = socket.gethostbyname(host)
        global textbox
        global checkbox_auto_scan_download
        global checkbox_auto_scan_process
        global checkbox_auto_vtotal
        global update_text
        global nlistview
        global ipinput
        global scan_detected_list
        global root
        global checkbox_auto_scan_download_var
        global checkbox_auto_scan_startup_var
        global checkbox_auto_scan_process_var
        global check_auto_vtotal_var
        global detected_list
        global _sql_server
        global _sql_hashdb
        global _sql_user
        global _sql_pass
        global q
        global menubar

        q = queue.Queue()
        checkbox_auto_scan_download_var = BooleanVar()
        checkbox_auto_scan_startup_var = BooleanVar()
        checkbox_auto_scan_process_var = BooleanVar()
        check_auto_vtotal_var = BooleanVar()
        detected_list = []

        _sql_server = ''
        _sql_hashdb = ''
        _sql_user = ''
        _sql_pass = ''

        menubar = Menu(root)
        menubar.config(background='black', activebackground='black')

        file = Menu(menubar)
        file.add_command(label='Get File Hash')
        file.add_command(label='Encrypt file')
        file.add_command(label='get file md5')

        database_menu = Menu(menubar)
        database_menu.add_command(label='Select database', command=menu._databasemenu)
        database_menu.add_command(label='search for hash', command=menu._selecthashmenu)
        database_menu.add_command(label='Add hash if not exist')

        account_menu = Menu(menubar)
        account_menu.add_command(label='Login')
        account_menu.add_command(label='Logoff')
        account_menu.add_command(label='Virus-Total API key')
        account_menu.add_command(label='Account settings')

        server_menu = Menu(menubar)
        server_menu.add_command(label='Enable Master mode')
        server_menu.add_command(label='Disable Master mode')

        about_menu = Menu(menubar)
        about_menu.add_command(label='Developers', command=menu.about_menu)

        menubar.add_cascade(label='File', menu=file)
        menubar.add_cascade(label='Database', menu=database_menu)
        menubar.add_cascade(label='Account', menu=account_menu)
        menubar.add_cascade(label='Server-Settings', menu=server_menu)
        menubar.add_cascade(label='About', menu=about_menu)

        tabocontrol = ttk.Notebook()
        tabocontrol.configure()
        tab1 = tkinter.Frame(tabocontrol)
        tab1.configure(bg='#424242')
        tab2 = ttk.Frame(tabocontrol)
        tab3 = ttk.Frame(tabocontrol)
        tab4 = ttk.Frame(tabocontrol)
        tabocontrol.add(tab1, text='Main')
        tabocontrol.add(tab2, text='Network')
        tabocontrol.add(tab3, text='Extensions')
        tabocontrol.add(tab4, text='System-Information')
        textbox = Text(tab1, height=5, width=200, font=("Helvetica", 10))
        textbox.configure(bg='grey', state=DISABLED)
        textbox.pack(side=BOTTOM)
        network_tab_control = ttk.Notebook(tab2)
        network_tab_control.pack(expand=1, fill="both")
        ntab1 = ttk.Frame(network_tab_control)
        ntab2 = ttk.Frame(network_tab_control)
        network_tab_control.add(ntab1, text='Firewall-Settings')
        network_tab_control.add(ntab2, text='Information')

        # MAIN TAB 1 #
        tabocontrol.pack(expand=1, fill="both")
        checkbox_auto_scan_download = Checkbutton(tab1, text='Auto-Scan Downloads', variable=checkbox_auto_scan_download_var, command=check_autoscan_download_box_status)
        checkbox_auto_scan_download.pack(anchor='ne')
        checkbox_auto_scan_download.configure(bg='#424242', fg='white', activebackground='#424242')
        checkbox_auto_scan_startup = Checkbutton(tab1, text='Auto-Scan Startup       ')
        checkbox_auto_scan_startup.pack(anchor='ne')
        checkbox_auto_scan_startup.configure(bg='#424242', fg='white', activebackground='#424242')
        checkbox_auto_scan_process = Checkbutton(tab1, text='Auto-Scan Process      ', variable=checkbox_auto_scan_process_var, command=check_autoscan_process_box_status)
        checkbox_auto_scan_process.pack(anchor='ne')
        checkbox_auto_scan_process.configure(bg='#424242', fg='white', activebackground='#424242')

        checkbox_auto_vtotal = Checkbutton(tab1, text='Virus-Total Scan     ', variable=check_auto_vtotal_var, command=check_auto_vtotal)
        checkbox_auto_vtotal.place(x=225, y=0)
        checkbox_auto_vtotal.configure(bg='#424242', fg='white', activebackground='#424242')

        network.startblockip()
        scan_detected_label = tkinter.Label(tab1, text='         Detected:')
        scan_detected_list = tkinter.Listbox(tab1)
        scan_detected_label.place(x=0, y=0)
        scan_detected_label.config(bg='#424242', fg='white')
        scan_detected_list.place(x=0, y=20)

        # NETWORK TAB 1 #
        ipa = Label(ntab1, text='IP:' + ipaddress)
        ipa.pack(anchor='ne')
        ipa.configure(bg='#424242', fg='white')
        style = ttkthemes.ThemedStyle(root)
        style.theme_use('black')
        nlistlistlabel = Label(ntab1, text="Blocked IP's")
        nlistlistlabel.place(x=0, y=0)
        nlistlistlabel.configure(bg='#424242', fg='red')
        nlistview = tkinter.Listbox(ntab1)
        nlistview.configure(bg='grey')
        for item in network.ipblocklist():
            nlistview.insert(END, item)
        nlistview.pack(anchor='nw')
        buttonunblockip = Button(ntab1, text='UnBlock  ')
        buttonunblockip.bind('<Button-1>', network.ipunblock)
        buttonunblockip.place(x=0, y=185)
        buttonblockip = Button(ntab1, text='Block        ')
        buttonblockip.bind('<Button-1>', network.blockip)
        buttonblockip.place(x=60, y=185)
        ipinput = Entry(ntab1)
        ipinput.place(x=0, y=210)

        # SYSTEM INFORMATION

        _syslabel = Label(tab4, text='System: {}'.format(platform.uname()[0]))
        _nodelabel = Label(tab4, text='Node: {}'.format(platform.uname()[1]))
        _releaselabel = Label(tab4, text='Release: {}'.format(platform.uname()[2]))
        _versionlabel = Label(tab4, text='Version: {}'.format(platform.uname()[3]))
        _machinelabel = Label(tab4, text='Machine: {}'.format(platform.uname()[4]))
        _proclabel = Label(tab4, text='Processor: {}'.format(platform.uname()[5]))

        _syslabel.pack(anchor='nw')
        _nodelabel.pack(anchor='nw')
        _releaselabel.pack(anchor='nw')
        _versionlabel.pack(anchor='nw')
        _machinelabel.pack(anchor='nw')
        _proclabel.pack(anchor='nw')
コード例 #11
0
ファイル: guinsspy.py プロジェクト: a513/GUINSSPY
    def __init__(self, top=None):
        global py3
        '''This class configures and populates the toplevel window.
           top is the toplevel containing window.'''
#        _bgcolor = '#c0bab4'  # X11 color: '#e0e0da'
        _bgcolor = 'white'  # X11 color: '#e0e0da'
        _fgcolor = '#000000'  # X11 color: 'black'
        _compcolor = '#d9d9d9' # X11 color: '#e0e0da'
        _ana1color = '#d9d9d9' # X11 color: '#e0e0da' 
#        _ana2color = '#d9d9d9' # X11 color: '#e0e0da' 
        _ana2color = '#e0e0da' # X11 color: '#e0e0da' 

        font10 = "-family courier -size 10 -weight normal -slant "  \
            "roman -underline 0 -overstrike 0"
        import ttkthemes
        self.style = ttkthemes.ThemedStyle()
        if (py3 == True):
    	    import ttkthemes
    	    self.style.theme_use('breeze')
    	    self.style.configure('TEntry',padding=-3)
    	    self.style.configure('TCombobox',padding=-3)
    	    self.style.configure('TButton',padding=3)
    	    self.style.configure('TButton',background='white')
        else:
    	    self.style.theme_use('arc')
        self.style.configure('.',background=_bgcolor)
        self.style.configure('.',foreground=_fgcolor)
        self.style.configure('.',font="TkDefaultFont")
        self.style.map('.',background=
            [('selected', _compcolor), ('active',_ana2color)])
        self.style.configure('white.TEntry', foreground='black')
        self.style.configure('blue.TEntry', foreground='blue')
        self.style.configure('red.TEntry', foreground='red')
        self.style.configure('cyan.TEntry', foreground='green')

        top.geometry("773x607+135+117")
        top.title("PKI. GUI for NSS")
        top.configure(borderwidth="2")
        top.configure(relief="flat")
        top.configure(background="#cdc7c2")

        self.Frame1 = Frame(top)
        self.Frame1.pack(expand=1,fill='both', padx= 0,pady= 0,side='top')
        self.Frame1.configure(borderwidth="0")
        self.Frame1.configure(background="#f7f6f5")
        self.Frame1.configure(width=775)

        self.TLabel1 = ttk.Label(self.Frame1, anchor=CENTER)
        self.TLabel1.pack(in_=self.Frame1, expand=0,fill='none',padx=5,pady= 5,side='top')
#        self.TLabel1.configure(background="#c0bab4")
        self.TLabel1.configure(background="#f7f6f5")
        self.TLabel1.configure(foreground="#000000")
        self.TLabel1.configure(font=("Times", 11, "bold", "italic"))
#        self.TLabel1.configure(borderwidth="3")
#        self.TLabel1.configure(relief=RIDGE)
        self.TLabel1.configure(relief=FLAT)
        self.TLabel1.configure(text=''' ИОК/PKI. GUI для Network Security Services ''')

#        self.TFrame1 = ttk.Frame(self.Frame1, relief=GROOVE, borderwidth="0", width=715)
        self.TFrame1 = Frame(self.Frame1, relief=GROOVE, borderwidth="0", background="#cdc7c2",width=715)
        self.TFrame1.pack(in_=self.Frame1,expand=1,fill='both',padx=5,pady=0,side='top')

        self.TFrameWho = []
        i = 0
#Фреймы для Юрлица, Физлица и ИП
        typeCert = ('Физическое лицо', 'Индивидуальный предприниматель', 'Юридическое лицо')
        for i in range(0,3):
#            self.TFrameWho[i].pack(in_=self.Frame1,expand=1,fill='both',padx=5,pady=5,side='top')
            self.TFrameWho.append(ttk.Frame(self.Frame1, relief=GROOVE, borderwidth="2", width=715))
            createWho(typeCert[i], self.TFrameWho[i], self)


        self.Frame2 = LabelFrame(self.TFrame1)
        self.Frame2.configure(text="Наши возможности", labelanchor='n', font='helvetica 10 bold roman')
        self.Frame2.pack(in_=self.TFrame1,expand=0,fill='y',padx=(0,3),pady=(3,0),side='right')

        self.Frame2.configure(relief=GROOVE)
        self.Frame2.configure(borderwidth="0")
        self.Frame2.configure(background="#eff0f1")
#        self.Frame2.configure(highlightbackground="#c0bab4")
        self.Frame2.configure(width=265)
#RadioButton
        self.typeRab = ["Разработчик", "Управление модулями PKCS#11",
	    "Управление сертификатами", "Подписать файл", "Зашифровать файл", 
	    "Проверить ЭП файла", "Извлечь оригинал из PKCS#7", "Создать запрос", "Создать SW/Cloud токен"]
        i = 0
        self.TButtonR = []
        count_rab = len(self.typeRab)
        for i in range(0, count_rab):
    	    self.TButtonRB = ttk.Radiobutton(self.Frame2, padding='2 3 2 4')
    	    self.TButtonRB.configure(text=self.typeRab[i])
    	    self.TButtonRB.configure(variable=guinsspy_support.varBut)
    	    self.TButtonRB.configure(value=i)
    	    self.TButtonRB.pack(in_=self.Frame2,expand=1,fill='x',side= 'top', anchor='s',ipady=6,padx=5,pady=0)
    	    self.TButtonRB.configure(command=guinsspy_support.ReloadNSS)
    	    self.TButtonR.append(self.TButtonRB)


        self.TButton10 = ttk.Button(top, command=sys.exit)
        self.TButton10.configure(takefocus="")
        self.TButton10.configure(text='''Завершаем''')

        self.Label1 = Label(self.Frame2)
        self.Label1.pack(in_=self.Frame2,anchor='center',expand=1,fill='both', ipadx=10,ipady=0,padx= 5,pady= 5,side='top')
        self.Label1.configure(activebackground="#ffffcd")
#        self.TButton10.pack(in_=self.Frame2,expand=1,fill='none',side= 'top' ,padx= 5)
        self.Label1.configure(background="#eff0f1")
        self.Label1.configure(disabledforeground="#b8a786")
        self.Label1.configure(highlightbackground="#c0bab4")
        self.Label1.configure(text='''Логотип''')

        self.Frame3 = Frame(self.TFrame1)
        self.Frame3.pack(in_=self.TFrame1,expand=1,fill='both',padx=3,pady=(3,0),side='left')
        self.Frame3.configure(borderwidth="0")
        self.Frame3.configure(relief=GROOVE)
        self.Frame3.configure(background="cyan")
        self.Frame3.configure(width=125)

        self.FrameRab = []

        i = 0
        for i in range(0,count_rab):
    	    self.Frame4 = LabelFrame(self.Frame3)
    	    self.Frame4.configure(text=self.typeRab[i], labelanchor='n', font='helvetica 10 bold roman')
    	    self.Frame4.configure(relief=FLAT)
    	    self.Frame4.configure(borderwidth="2")
    	    self.Frame4.configure(background="white")
#    	    self.Frame4.configure(background="#f7f6f5")
    	    self.FrameRab.append(self.Frame4)

        self.Labelframe1 = LabelFrame(self.Frame1)
        self.Labelframe1.pack (in_=self.Frame1,expand=0,fill='x',side='bottom', padx=5,pady=(0,3)) 
        self.Labelframe1.configure(relief=GROOVE)
        self.Labelframe1.configure(borderwidth="0")
        self.Labelframe1.configure(text='Выберите тип хранилища сертификатов и путь к нему', labelanchor='n', font='helvetica 10 bold roman')
#        self.Labelframe1.configure(background="#eff0f1")
        self.Labelframe1.configure(background="white")
        self.Labelframe1.configure(highlightbackground="#cdc7c2", highlightcolor="#cdc7c2", highlightthickness='3')
        self.Labelframe1.configure(width=150)

        self.Frame5 = Frame(self.Labelframe1, bg='#e0e0da')
        self.Frame5.pack (anchor='center',expand=0,fill='none',side='left', padx=5, pady='1mm 2mm') 
        self.Frame5.configure(relief=GROOVE)
        self.Frame5.configure(borderwidth="0")
#ttk::style map MyBorder.TButton -background [list disabled white pressed gray64 active skyblue !active #e2e2e1]
        self.style.map('TButton',background=[('disabled', 'white'), ('pressed', 'gray64'), ('active', 'skyblue'), ('!active', '#e2e2e1')])

        self.style.map('TRadiobutton',background=[('selected', _bgcolor), ('active', _ana2color)])
        self.TRadiobutton1 = ttk.Radiobutton(self.Frame5)

        self.TRadiobutton1.configure(variable=guinsspy_support.varDB)
        self.TRadiobutton1.configure(value="0")
        self.TRadiobutton1.configure(takefocus="")
        self.TRadiobutton1.configure(text='''Berkeley DB''')

        self.TRadiobutton2 = ttk.Radiobutton(self.Frame5)
        self.TRadiobutton2.configure(variable=guinsspy_support.varDB)
        self.TRadiobutton2.configure(value="1")
        self.TRadiobutton2.configure(takefocus="")
        self.TRadiobutton2.configure(text='''SQLite''')
        self.TRadiobutton1.pack(in_=self.Frame5, anchor='center',expand=0,fill='none',side='left', padx=0, pady=0)
        self.TRadiobutton2.pack(in_=self.Frame5, anchor='center',expand=0,fill='none',side='left', padx=2, pady=0)

        self.Entry1 = ttk.Entry(self.Labelframe1)
        self.Entry1.pack(anchor='center',expand=1,fill='x',side='left') 
        self.Entry1.configure(background="white")
        self.Entry1.configure(font=font10)

        self.TButton11 = Button(self.Labelframe1)

        self.TButton11.pack(anchor='w',side='right', padx='0 5', pady='2mm 2mm')
        self.TButton11.configure(command=(lambda:guinsspy_support.selectDB(self)))
        self.TButton11.configure(takefocus="")
コード例 #12
0
ファイル: GUI.py プロジェクト: vemiz/errordetector
    def run(self):
        """
        Starts the application.
        """
        # Setup window
        self.root = Tk()
        #self.root.iconbitmap(self, default="clienticon.ico")
        self.root.style = ttkthemes.ThemedStyle()
        self.root.style.theme_use('black')
        # self.root.geometry("800x400")
        self.root.title("3D print error detection")
        self.label1 = Label(self.root,
                            text="3D print Error Detection Application",
                            font=2)
        self.root.protocol('WM_DELETE_WINDOW', self.quit)

        self._folderPath = StringVar()

        # HSV Presets
        self._hsvcolor = tk.StringVar(self.root)
        self._hsvcolor.set(self._hsvpresets[0])
        self._hsvcolor.trace("w", self.setpreset)

        # HSV variables
        self._hue_max = tk.IntVar()
        self._hue_max.set(179)
        self._hue_min = tk.IntVar()
        self._hue_min.set(0)
        self._sat_max = tk.IntVar()
        self._sat_max.set(255)
        self._sat_min = tk.IntVar()
        self._sat_min.set(0)
        self._val_max = tk.IntVar()
        self._val_max.set(255)
        self._val_min = tk.IntVar()
        self._val_min.set(0)
        # Frames
        self.cameracontrolframe = Frame(self.root)
        self.cameracontrolframe.grid(row=1, column=1, columnspan=4)
        self.hsvframe = Frame(self.root)
        self.hsvframe.grid(row=3, column=1, rowspan=8, columnspan=3)
        self.maskbtnframe = Frame(self.hsvframe)
        self.maskbtnframe.grid(row=7, column=2, rowspan=2)
        self.hsvpresetframe = Frame(self.root)
        self.hsvpresetframe.grid(row=4, column=4, rowspan=4, sticky="W")
        self.morphframe = Frame(self.root)
        self.morphframe.grid(row=8, column=4, rowspan=4, sticky="W")

        self.hsvlabel = Label(self.hsvframe, text="HSV thresholding", font=2)
        self.hsvlabel.grid(row=0, column=0, columnspan=3, pady=5, sticky="S")
        # Buttons
        self.startcamerabtn = Button(self.cameracontrolframe,
                                     text="Start camera",
                                     width=14,
                                     relief="raised",
                                     fg='black',
                                     command=self.opencamerapage)
        self.savemaskedbtn = Button(self.cameracontrolframe,
                                    text="Save Masked Images",
                                    width=18,
                                    relief="raised",
                                    fg='black',
                                    command=self.savemasked)
        self.startlastimgpagebtn = Button(self.cameracontrolframe,
                                          text="Latest Image",
                                          width=14,
                                          relief="raised",
                                          command=self.openimagepage)
        self.startsecondlastimgpagebtn = Button(
            self.cameracontrolframe,
            text="Second to Last Image",
            width=18,
            relief="raised",
            command=self.opensecondimagepage)
        self.quitbtn = Button(self.cameracontrolframe,
                              text="Quit",
                              width=10,
                              fg='black',
                              command=self.quit)

        self.startloggingbtn = Button(self.root,
                                      text="Start logging",
                                      fg='black',
                                      command=self.startlogging)

        self.addmaskbtn = Button(self.maskbtnframe,
                                 text="Add Mask",
                                 width=14,
                                 relief="raised",
                                 fg='black',
                                 command=self.addmask)
        self.invertmaskbtn = Button(self.maskbtnframe,
                                    text="Invert Mask",
                                    width=14,
                                    relief="raised",
                                    fg='black',
                                    command=self.invertmask)
        self.hsvresetbtn = Button(self.hsvpresetframe,
                                  text="Reset HSV",
                                  fg='black',
                                  width=12,
                                  command=self.hsvreset)
        self.hsvpresetbtn = Button(self.hsvpresetframe,
                                   text="Save HSV Preset",
                                   fg='black',
                                   width=12,
                                   command=self.savehsvpreset)
        self.usehsvpresetbtn = Button(self.hsvpresetframe,
                                      text="Use HSV Preset",
                                      fg='black',
                                      width=12,
                                      command=self.usehsvpreset)
        self.presetmenu = OptionMenu(self.hsvpresetframe, self._hsvcolor,
                                     self._hsvpresets[0], self._hsvpresets[1],
                                     self._hsvpresets[2])
        self.presetmenu.config(width=9)
        self.prntbtn = Button(self.root,
                              text="Print",
                              command=self.facade.printregister)

        self.chechsimilaritybtn = Button(self.root,
                                         text="Similarity",
                                         fg='black',
                                         command=self.chechsimilarity)

        self.erodebtn = Button(self.morphframe,
                               text="Erode",
                               width=12,
                               relief="raised",
                               command=self.erode)
        self.dilateebtn = Button(self.morphframe,
                                 text="Dilate",
                                 width=12,
                                 relief="raised",
                                 command=self.dilate)
        self.openbtn = Button(self.morphframe,
                              text="Open",
                              width=12,
                              relief="raised",
                              command=self.open)
        self.closebtn = Button(self.morphframe,
                               text="Close",
                               width=12,
                               relief="raised",
                               command=self.close)

        self.threshenter = Button(self.root,
                                  text="Enter",
                                  command=self.enterthresh)
        self.threshentry = Entry(self.root)
        self.threshlabel = Label(self.root, text="Set thresh: ", fg='black')

        self.aboutbtn = Button(self.root,
                               text="About",
                               command=self.showaboutinfo)

        # Placing elements
        self.label1.grid(row=0, column=1, columnspan=5, pady=10)

        self.startcamerabtn.grid(row=0, column=0)
        self.savemaskedbtn.grid(row=0, column=1)
        self.startlastimgpagebtn.grid(row=0, column=2)
        self.startsecondlastimgpagebtn.grid(row=0, column=3)
        self.quitbtn.grid(row=0, column=4)

        #self.startloggingbtn.grid(row=13, column=4, sticky="w")

        self.hsvresetbtn.grid(row=4, column=1)
        self.hsvpresetbtn.grid(row=3, column=1)
        self.usehsvpresetbtn.grid(row=1, column=1)
        self.presetmenu.grid(row=2, column=1)

        self.prntbtn.grid(row=14, column=3, sticky="E")
        self.chechsimilaritybtn.grid(row=14, column=4, sticky="W")

        self.addmaskbtn.grid(row=1, column=1, rowspan=2, sticky="E")
        self.invertmaskbtn.grid(row=1, column=2, rowspan=2, sticky="W")

        self.erodebtn.grid(row=11, column=5)
        self.dilateebtn.grid(row=12, column=5)
        self.openbtn.grid(row=13, column=5)
        self.closebtn.grid(row=14, column=5)
        self.threshlabel.grid(row=13, column=2)
        self.threshentry.grid(row=14, column=2)
        self.threshenter.grid(row=15, column=2)

        self.aboutbtn.grid(row=0, column=4, sticky="E")

        # Hue, Saturation, Value
        self.hue_max_label = Label(self.hsvframe, text="Hue max")
        self.hue_max_scale = Scale(self.hsvframe,
                                   from_=0,
                                   to=179,
                                   length=200,
                                   orient=HORIZONTAL,
                                   variable=self._hue_max)
        self.hue_min_label = Label(self.hsvframe, text="Hue min")
        self.hue_min_scale = Scale(self.hsvframe,
                                   from_=0,
                                   to=179,
                                   length=200,
                                   orient=HORIZONTAL,
                                   variable=self._hue_min)
        self.sat_max_label = Label(self.hsvframe, text="Saturation max")
        self.sat_max_scale = Scale(self.hsvframe,
                                   from_=0,
                                   to=255,
                                   length=200,
                                   orient=HORIZONTAL,
                                   variable=self._sat_max)
        self.sat_min_label = Label(self.hsvframe, text="Saturation min")
        self.sat_min_scale = Scale(self.hsvframe,
                                   from_=0,
                                   to=255,
                                   length=200,
                                   orient=HORIZONTAL,
                                   variable=self._sat_min)
        self.val_max_label = Label(self.hsvframe, text="Value max")
        self.val_max_scale = Scale(self.hsvframe,
                                   from_=0,
                                   to=255,
                                   length=200,
                                   orient=HORIZONTAL,
                                   variable=self._val_max)
        self.val_min_label = Label(self.hsvframe, text="Value min")
        self.val_min_scale = Scale(self.hsvframe,
                                   from_=0,
                                   to=255,
                                   length=200,
                                   orient=HORIZONTAL,
                                   variable=self._val_min)
        # Hue
        self.hue_max_label.grid(row=1, column=1, sticky="E")
        self.hue_max_scale.grid(row=1, column=2)
        self.hue_min_label.grid(row=2, column=1, sticky="E")
        self.hue_min_scale.grid(row=2, column=2)
        # Saturation
        self.sat_max_label.grid(row=3, column=1, sticky="E")
        self.sat_max_scale.grid(row=3, column=2)
        self.sat_min_label.grid(row=4, column=1, sticky="E")
        self.sat_min_scale.grid(row=4, column=2)
        # Value
        self.val_max_label.grid(row=5, column=1, sticky="E")
        self.val_max_scale.grid(row=5, column=2)
        self.val_min_label.grid(row=6, column=1, sticky="E")
        self.val_min_scale.grid(row=6, column=2)

        # Start GUI mainloop
        self.root.mainloop()
コード例 #13
0
                defaultextension=".txt",
                filetypes=[
                    ("All files", "*.*"),
                    ("Text files", "*.txt"),
                    ("Python Script", "*.py"),
                    ("Stylesheet", "*.css"),
                    ("Webpage", "*.html"),
                ])
            textarea_content = self.textarea.get(1.0, tk.END)
            with open(new_file, "w") as f:
                f.write(textarea_content)
            self.filename = new_file
            self.set_window_title(self.filename)
            self.statusbar.update_status(True)
        except Exception as e:
            print(e)

    def bind_shortcuts(self):
        self.textarea.bind('<Control-n>', self.new_file)
        self.textarea.bind('<Control-o>', self.open_file)
        self.textarea.bind('<Control-s>', self.save_file)
        self.textarea.bind('<Control-S>', self.save_as)
        self.textarea.bind('<Key>', self.statusbar.update_status)

if __name__ == "__main__":
    master = tk.Tk()
    master.style = ttkthemes.ThemedStyle()
    master.style.theme_use('black')
    pt = Text(master)
    master.mainloop()