Пример #1
0
import tkinter as tk
from tkinter import ttk
win = tk.Tk()
win.title('SUBSCRIBTION RECORD TO A TEXT FILE')
#create Labels
name_label = ttk.Label(win, text='Enter your name:')
name_label.grid(row=0, column=0, sticky=tk.W)
age_label = ttk.Label(win, text="Enter your age")
age_label.grid(row=1, column=0, sticky=tk.W)
email_label = ttk.Label(win, text="Enter your email-id")
email_label.grid(row=2, column=0, sticky=tk.W)
gender_label = ttk.Label(win, text="Select your gender")
gender_label.grid(row=3, column=0, sticky=tk.W)
# create entry box
name_var = tk.StringVar()
name_entrybox = ttk.Entry(win, width=15, textvariable=name_var)
name_entrybox.grid(row=0, column=1)
name_entrybox.focus()
age_var = tk.StringVar()
age_entrybox = ttk.Entry(win, width=15, textvariable=age_var)
age_entrybox.grid(row=1, column=1)
email_var = tk.StringVar()
email_entrybox = ttk.Entry(win, width=15, textvariable=email_var)
email_entrybox.grid(row=2, column=1)


#create button
def action():
    name = name_var.get()
    age = age_var.get()
    email = email_var.get()
Пример #2
0

def sent():
    #login by using username and password
    smtpobj.login(f"{gmail}", f"{password}")
    #send message sender address,receiver address and Subject to fill messsage body -
    #respectively
    smtpobj.sendmail(
        "*****@*****.**", "*****@*****.**",
        "Subject:\n John I would like to thank you for all you have done to me"
    )
    #quit the connection to the server
    smtplib.quit()


label_e = ttk.Label(win, text="Enter Your Gmail Account")
label_e.grid(column=0, row=0)
entry_e = ttk.Entry(win, textvariable=gmail)
entry_e.grid(column=0, row=1)
label_p = ttk.Label(win, text="Enter Your Gmail Password")
label_p.grid(column=0, row=2)
entry_p = ttk.Entry(win, textvariable=password)
entry_p.grid(column=0, row=3)
#step1:Create smtp object
#if This is not valid to create the object use SSL encryption  (smtplib.SMTP_SSL("smtp.gmail.com",465)
#"smtp.gmail.com" server domain name for gmail check for other
smtpobj = smtplib.SMTP("smtp.gmail.com", 587)
#create a hello greeting for the server
smtpobj.ehlo()
#we should start tls encryption(skip this step if it is SSL)
smtpobj.starttls()
Пример #3
0
    def __init__(self, env_data):
        self._root = tk.Tk()
        self._root.title('Tokemon Trading Bot')

        # self._root.geometry('500x100')
        # self._root.resizable(width=True, height=True)

        self._root.grid_columnconfigure(0, weight=1)
        self._root.grid_rowconfigure(0, weight=1)

        self._frame = ttk.Frame(self._root)
        self._frame.columnconfigure(1, weight=1)
        self._frame.columnconfigure(1, weight=3)

        self._thread = None

        def _label_entry(_lbl, _txt, _row, is_password=False, **gridpos):
            l = ttk.Label(self._frame, text=_lbl)
            l.grid(column=0, row=_row, sticky='W', padx=5, pady=5, **gridpos)

            sv = tk.StringVar()
            sv.set(_txt or '')
            sve = ttk.Entry(self._frame,
                            textvariable=sv,
                            show="*" if is_password else None)
            sve.grid(column=1,
                     row=_row,
                     padx=5,
                     pady=5,
                     sticky="EW",
                     **gridpos)

            return sv

        self._gui_env_entries = {
            'username':
            _label_entry('Tokemon Username',
                         env_data.get('username') or '', 1),
            'token':
            _label_entry('Tokemon Bot Token',
                         env_data.get('token') or '', 2),
            'ethereum_provider':
            _label_entry('Infura URL',
                         env_data.get('ethereum_provider') or '', 3)
        }

        acts = env_data['accounts']
        self._base_url = env_data['base_url']

        def _acct_entry(_num, _act, _row0):
            return {
                'account_%d_name' % _num:
                _label_entry('Account %d Name' % _num,
                             _act.get('name') or '', _row0),
                'account_%d_address' % _num:
                _label_entry('Account %d Address' % _num,
                             _act.get('address') or '', _row0 + 1),
                'account_%d_pkey' % _num:
                _label_entry('Account %d Private Key' % _num,
                             _act.get('pkey') or '', _row0 + 2, True)
            }

        row = 4
        if len(acts) <= 1:
            try:
                act_1 = acts[tuple(acts.keys())[0]]
            except IndexError:
                act_1 = {'name': None, 'address': None, 'pkey': None}

            self._gui_env_entries.update(_acct_entry(1, act_1, row))
            row += 3

        else:
            for i, act_name in enumerate(acts):
                act = acts[act_name]
                self._gui_env_entries.update(_acct_entry(i + 1, act, row))
                row += 3

        self._button = ttk.Button(self._frame,
                                  text='Reconnect',
                                  state='disabled')
        self._button.grid(column=1, row=row, sticky='E', padx=5, pady=5)
        self._button.configure(command=self._button_clicked)

        row += 1

        self._result_label = ttk.Label(self._frame)
        self._result_label.grid(row=row, columnspan=3, padx=5, pady=5)

        self._frame.grid(padx=10, pady=10, sticky='NSEW')
Пример #4
0
    def __init__(self, master):
        form.Frame.__init__(self, master)

        master.title(STRGS['ITINERARIES'])
        master.geometry(
            "%dx%d+%d+%d" %
            (500, 500, int(master.winfo_screenwidth() / 2 - 500 / 2),
             int(master.winfo_screenheight() / 2 - 500 / 2)))
        master.resizable(False, False)

        frItineraries = ttk.LabelFrame(master, text=STRGS['ITINERARIES'])
        frItineraries.grid(column=0, row=0, padx=5, pady=5)

        #listbox with itineraries
        scrollbar = ttk.Scrollbar(frItineraries)
        self.lboxItinerariesList = form.Listbox(frItineraries,
                                                width=30,
                                                height=18,
                                                yscrollcommand=scrollbar.set)
        self.lboxItinerariesList.grid(column=0, row=0, padx=3, pady=3)
        self.lboxItinerariesList.bind("<ButtonRelease-1>",
                                      self.showDetailsItineraries)
        for itineraryObj in itinerariesList:
            self.lboxItinerariesList.insert(form.END, itineraryObj.name)
        scrollbar.config(command=self.lboxItinerariesList.yview)

        frButtons = ttk.Frame(master)
        frButtons.grid(column=1, row=0, padx=5, pady=5, sticky=form.N)

        ttk.Button(frButtons,
                   text=STRGS['ADD_NEW'],
                   width=15,
                   command=self.addNewItinerary).grid(column=0,
                                                      row=0,
                                                      padx=2,
                                                      pady=2)
        ttk.Button(frButtons,
                   text=STRGS['EDIT'],
                   width=15,
                   command=self.editItinerary).grid(column=0,
                                                    row=1,
                                                    padx=2,
                                                    pady=2)
        ttk.Button(frButtons,
                   text=STRGS['DELETE'],
                   width=15,
                   command=self.deleteItinerary).grid(column=0,
                                                      row=2,
                                                      padx=2,
                                                      pady=2)

        #TODO: add two buttons to change order?  (up/down)

        frItineraryDetail = ttk.LabelFrame(master, text=STRGS['DETAILS'])
        frItineraryDetail.grid(column=0,
                               row=1,
                               columnspan=2,
                               padx=5,
                               pady=5,
                               sticky=form.W)

        self.lblProperties = ttk.Label(frItineraryDetail, width=50)
        self.lblProperties.grid(column=0, row=0, padx=3, pady=3)

        master.grab_set()
        master.focus()
Пример #5
0
    root.grid_rowconfigure(12)
    root.resizable(False, False)  # Fix Window Size
    content = ttk.Frame(root)

    # frame = ttk.Frame(content, relief="sunken", width=800, height=600)

    # Variables
    tokenSeparator = StringVar(value=";")
    logFilename = StringVar(value="<log file>")
    parserString = StringVar()
    fieldString = StringVar()
    fields_list = StringVar()
    fields_list.set(('a:integer', 'b:float', 'c:str'))

    # Component Creation
    lblBrowse = ttk.Label(content, textvariable=logFilename)

    btnBrowse = ttk.Button(content, text="Browse", command=browseLog)
    lbxFields = Listbox(content, selectmode="SINGLE", listvariable=fields_list)
    txtAddField = ttk.Entry(content, textvariable=fieldString)
    btnAddField = ttk.Button(content, text="Add", command=addField)
    btnMovDnField = ttk.Button(content, text="Move Down", command=moveDn)
    btnMovUpField = ttk.Button(content, text="Move Up", command=moveUp)

    btnRemField = ttk.Button(content, text="Remove", command=removeField)
    btnEdtField = ttk.Button(content, text="Edit", command=editField)

    btnParse = ttk.Button(content, text="Parse", command=parse)
    btnCancel = ttk.Button(content, text="Cancel", command=root.destroy)

    txtSeparator = ttk.Entry(content, textvariable=tokenSeparator)
Пример #6
0
URL_var = tk.StringVar()
ini_sec_var = tk.StringVar()
fin_sec_var = tk.StringVar()

# Creando un objeto de clase PhotoImage
v_ico = tk.PhotoImage(file='V_DL.png')

# Seleccionar el icono de la aplicación
ventana.iconphoto(False, v_ico)

# Marco del URL del vídeo a descargar
mar_URL = ttk.Frame(ventana)
mar_URL.pack(padx=4, pady=4)

# Elementos del marco URL
URL_lbl = ttk.Label(mar_URL, text="URL del vídeo:").grid(row=0, column=0)
URL_ent = ttk.Entry(mar_URL, textvariable=URL_var,
                    width=150).grid(row=0, column=1)
URL_pega_btn = ttk.Button(mar_URL, text="PEGAR",
                          command=lambda: URL_pegar(pp.paste())).grid(row=0, column=2)
URL_borra_btn = ttk.Button(mar_URL, text="BORRAR",
                           command=URL_borrar).grid(row=0, column=3)

# Marco de la duración de la secuencia a descargar
mar_sec = ttk.Frame(ventana)
mar_sec.pack(padx=4, pady=4)

# Elementos del marco secuencia
ini_sec_lbl = ttk.Label(
    mar_sec, text="Inicio de secuencia:").grid(row=0, column=0)
ini_sec_ent = ttk.Entry(mar_sec, textvariable=ini_sec_var,
Пример #7
0
    def __init__(self, root):
        super().__init__(root)

        self["padding"] = (7, 7, 9, 9)

        self.root = root
        self.fileStorage = self.root.fileStorage

        # file selection
        self.saveToVar = StringVar()
        self.saveToVar.set(True)
        self.fileStorageFrame = FileStorageFrame(self)
        self.fileStorageFrame.grid(column=1,
                                   row=0,
                                   columnspan=2,
                                   sticky=(N, S, E, W),
                                   pady=5,
                                   padx=2)

        # statusbar
        self.status = StringVar()

        self.statusBar = ttk.Label(self, textvariable=self.status)
        self.statusBar.grid(column=0, row=4, columnspan=2, sticky=(S, E, W))

        # control button
        self.process = ttk.Button(self,
                                  text="Control",
                                  command=self.controlFun)
        self.process.grid(column=2, row=4, sticky=E)
        self.process.state(["disabled"])

        # report
        self.reportFrame = ttk.LabelFrame(self, text="Report")
        self.reportFrame.grid(column=0,
                              row=0,
                              rowspan=4,
                              sticky=(N, S, E, W),
                              padx=5)
        self.reportFrame.columnconfigure(0, weight=1)
        self.reportFrame.rowconfigure(0, weight=1)

        self.upFrame = ttk.Frame(self.reportFrame)
        self.upFrame.grid(column=0, row=0, columnspan=2, sticky=(N, S, E, W))
        self.upFrame.columnconfigure(0, weight=1)
        self.upFrame.rowconfigure(0, weight=1)

        self.contentTree = ttk.Treeview(self.upFrame, selectmode="none")
        self.contentTree.grid(column=0, row=0, sticky=(N, S, E, W))
        self.contentTree["columns"] = ("description", "importance", "tag")
        self.contentTree.column("#0", width=250, anchor="w")
        self.contentTree.heading("#0",
                                 text="Problem",
                                 command=lambda: self.orderReport("name"))
        self.contentTree.column("description", width=200, anchor="e")
        self.contentTree.heading(
            "description",
            text="Description",
            command=lambda: self.orderReport("description"))
        self.contentTree.column("importance", width=60, anchor="e")
        self.contentTree.heading(
            "importance",
            text="Importance",
            command=lambda: self.orderReport("importance"))
        self.contentTree.column("tag", width=10, anchor="center")
        self.contentTree.heading("tag",
                                 text="Tag",
                                 command=lambda: self.orderReport("tag"))
        self.scrollbar = ttk.Scrollbar(self.upFrame,
                                       orient=VERTICAL,
                                       command=self.contentTree.yview)
        self.scrollbar.grid(column=1, row=0, sticky=(N, S, E))
        self.contentTree.configure(yscrollcommand=self.scrollbar.set)

        self.saveToFrame = SaveToFrame(self.reportFrame, label=False)
        self.saveToFrame.grid(column=0, row=1, sticky=(E, W))

        self.saveBut = ttk.Button(self.reportFrame,
                                  text="Save",
                                  command=self.saveFun)
        self.saveBut.grid(column=1, row=1, sticky=E, padx=2)

        self.controlReport = ControlReport(self)

        self.contentTree.tag_bind("file", "<Double-1>",
                                  lambda e: self.treeDoubleClick(e))
        self.contentTree.tag_bind("file", "<3>", lambda e: self.filePopUp(e))
        self.contentTree.tag_bind("ok", "<3>", lambda e: self.okPopUp(e))
        self.contentTree.tag_bind("control", "<3>",
                                  lambda e: self.controlPopUp(e))
        self.contentTree.tag_configure("comment", background=commentColor())

        # method selection frame
        self.controlFrame = ControlFrame(self)
        self.controlFrame.grid(column=1,
                               row=1,
                               columnspan=2,
                               sticky=(N, W),
                               padx=10,
                               pady=55)

        # time frame
        self.timeFrame = TimeFrame(self)
        self.timeFrame.grid(column=1,
                            row=2,
                            columnspan=2,
                            sticky=(N, W),
                            padx=10)

        self.columnconfigure(0, weight=1)
        self.rowconfigure(2, weight=1)
Пример #8
0
# Adding frame to root Tk window
mainframe = ttk.Frame(root, padding="5")
# Configuring main frame of the window
mainframe.grid(column=0, row=0, sticky=(N, W, E, S))

# Causes main frame to resize with window resize
mainframe.columnconfigure(0, weight=1)
mainframe.rowconfigure(0, weight=1)

# Frame for file path and key input widgets
fpkframe = ttk.Frame(mainframe)
fpkframe.grid(column=0, row=0, sticky=W)

# Label and text field entry for file path
ttk.Label(fpkframe, text="File Path: ").grid(column=0, row=0, sticky=E)
path_entry = ttk.Entry(fpkframe, width=40, textvariable=path_entry_text)
path_entry.grid(column=1, row=0, sticky=(W, E))  # Stretches entry text field

# Label for output directory and textfield entry
ttk.Label(fpkframe, text="Out Directoy: ").grid(column=0, row=1, sticky=W)
od_entry = ttk.Entry(fpkframe, width=40, textvariable=out_dir)
od_entry.grid(column=1, row=1, sticky=(W, E), pady=(10, 0))

# Seperator line between fpk and od frames
ttk.Separator(mainframe, orient="horizontal").grid(column=0,
                                                   row=1,
                                                   sticky=(E, W))

#frame for encryption params
encframe = ttk.Frame(mainframe)
Пример #9
0
    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 {Vivaldi} -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='''Song name''',font=("Times New Roman",22,"bold","italic"))
        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.Button(top)
        self.previousButton.place(relx=0.493, rely=0.266, height=34, width=34)
        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='''Button''')

        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="2")
        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="2")
        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)
        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)
        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)
        self.Button11.place(relx=0.815, rely=0.913, height=42, width=42)
        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.Button11.configure(width=48)
        self.setup_player()
        self.Button9.config(command=self.add_song_to_myfavourite)
        self.Button10.config(command=self.remove_song_to_myfavourite)
        self.Button11.config(command=self.load_song_to_myfavourites)
Пример #10
0
def build_ui(
    *,
    root,
    countries,
    smashgg_tab,
    p1_wins,
    p2_wins,
    apply_state,
    discard_unapplied_state,
    reset_scores,
    swap_players,
    trace_widget,
):
    root.title("Overly Repetitive Tedious Software")

    style = ttk.Style()
    # Default Windows theme (xpnative/vista) doesn't support `fieldbackground`
    # so we're settling with "clam" theme for now.
    style.theme_use("clam")
    style.configure("Active.TEntry", fieldbackground="#dffcde")
    style.configure("Active.TCombobox", fieldbackground="#dffcde")
    style.configure("Active.TSpinbox", fieldbackground="#dffcde")

    # 2 tabs in main Notebook
    notebook = ttk.Notebook(root)
    notebook.grid(column=0, row=0, sticky=(N, S, E, W))
    frame1 = ttk.Frame(notebook, padding=5)
    frame2 = smashgg_tab.init_frame(notebook)
    notebook.add(frame1, text="Main")
    notebook.add(frame2, text="Smash.gg")

    # Main tab has these frames:
    misc = ttk.Frame(frame1, padding=(0, 0, 0, 7))
    players = ttk.Frame(frame1, padding=(0, 0, 0, 0))
    actions = ttk.Frame(frame1, padding=(0, 7, 0, 0))
    misc.grid(column=0, row=0, sticky=(N, S, E, W))
    players.grid(column=0, row=1, sticky=(N, S, E, W))
    actions.grid(column=0, row=2, sticky=(N, S, E, W))

    # Misc: (fields not belonging to any player)
    descriptionlbl = ttk.Label(misc, text="Match description")
    description = ttk.Entry(misc)
    trace_widget(description, "description", "TEntry")
    descriptionlbl.grid(column=0, row=0, padx=(0, 4))
    description.grid(column=1, row=0, sticky=(E, W))
    misc.grid_columnconfigure(1, weight=1)

    # Players:

    ## Declare widgets, bind values:

    name1lbl = ttk.Label(players, text="Player 1")
    name1 = AutocompleteCombobox(players, width="30")
    trace_widget(name1, "p1name", "TCombobox")

    country1 = ttk.Combobox(players, width="6", values=countries)
    trace_widget(country1, "p1country", "TCombobox")

    score1 = ttk.Spinbox(players, from_=0, to=777, width="4")
    trace_widget(score1, "p1score", "TSpinbox")

    team1lbl = ttk.Label(players, text="Team 1")
    team1 = AutocompleteCombobox(players)
    trace_widget(team1, "p1team", "TCombobox")

    win1 = ttk.Button(players, text="▲ Win", width="6", command=p1_wins)

    name2lbl = ttk.Label(players, text="Player 2")
    name2 = AutocompleteCombobox(players, width="30")
    trace_widget(name2, "p2name", "TCombobox")

    country2 = ttk.Combobox(players, width="6", values=countries)
    trace_widget(country2, "p2country", "TCombobox")

    score2 = ttk.Spinbox(players, from_=0, to=777, width="4")
    trace_widget(score2, "p2score", "TSpinbox")

    team2lbl = ttk.Label(players, text="Team 2")
    team2 = AutocompleteCombobox(players)
    trace_widget(team2, "p2team", "TCombobox")

    win2 = ttk.Button(players, text="▲ Win", width="6", command=p2_wins)

    ## Layout via grid:

    name1lbl.grid(column=0, row=0, padx=(0, 2))
    name1.grid(column=1, row=0, padx=2)
    country1.grid(column=2, row=0, padx=2)
    score1.grid(column=3, row=0, padx=2)
    win1.grid(column=4, row=0, padx=(2, 0), rowspan=2, sticky=(N, S))
    team1lbl.grid(column=0, row=1, padx=(0, 2))
    team1.grid(column=1, row=1, padx=2, columnspan=3, sticky=(E, W))

    ttk.Separator(players, orient=HORIZONTAL).grid(column=0,
                                                   row=2,
                                                   columnspan=5,
                                                   sticky="ew",
                                                   pady=10)

    name2lbl.grid(column=0, row=3, padx=(0, 2))
    name2.grid(column=1, row=3, padx=2)
    country2.grid(column=2, row=3, padx=2)
    score2.grid(column=3, row=3, padx=2)
    win2.grid(column=4, row=3, padx=(2, 0), rowspan=2, sticky=(N, S))
    team2lbl.grid(column=0, row=4, padx=(0, 2))
    team2.grid(column=1, row=4, padx=2, columnspan=3, sticky=(E, W))

    def update_player_names(players_dict):
        names = sorted(players_dict.keys(), key=lambda s: s.casefold())
        name1.set_possible_values(names)
        name2.set_possible_values(names)

        # set comprehension to ensure no repeated team values
        teams = sorted(
            {team
             for country, team in players_dict.values() if team})
        team1.set_possible_values(teams)
        team2.set_possible_values(teams)

    smashgg_tab.callbacks.append(update_player_names)
    # Update once on init too
    update_player_names(smashgg_tab.players_dict)

    # Actions:
    apply = ttk.Button(actions, text="▶ Apply", command=apply_state)
    discard = ttk.Button(actions,
                         text="✖ Discard",
                         command=discard_unapplied_state)
    reset = ttk.Button(actions, text="↶ Reset scores", command=reset_scores)
    swap = ttk.Button(actions, text="⇄ Swap players", command=swap_players)
    apply.grid(column=0, row=0, padx=(0, 5))
    discard.grid(column=1, row=0, padx=5)
    reset.grid(column=2, row=0, padx=5)
    swap.grid(column=3, row=0, padx=5)

    root.mainloop()
Пример #11
0
    def control_panel(self):
        for w in [self.plus, self.minus, self.bad, self.scale, self.combo]:
            if w is not None:
                w.destroy()
                w = None

        # Test Control validity
        if self.device.control is None:
            self.bad = ttk.Label(self.tab,
                                 text="{} control not found at {}".format(
                                     self.device.title, self.device.syspath))
            self.bad.pack(expand=1, fill="both", padx=10, pady=10)
            return

        # Scale (brightness slider)
        # possibly get settings from init file
        self.scale = tk.Scale(self.tab,
                              from_=0,
                              to=self.device.max,
                              orient="horizontal",
                              resolution=self.device.delta,
                              bd=5,
                              width=20,
                              showvalue=0)
        self.scale.set(self.device.brightness)
        self.scale.config(command=self.setlevel)

        # combobox to choose file type
        self.combo = ttk.Combobox(self.tab,
                                  values=self.device.controllist,
                                  state="readonly",
                                  exportselection=0,
                                  textvariable=self.controlvar)
        self.combo.set(self.device.control)
        self.controlvar.trace('w', self.setcontrol)

        # plus and minus Buttons
        if type(self).buttonfont is None:
            plus = tk.Button(self.tab, text="+")
            buttonfont = font.Font(font=plus.cget("font")).actual()
            type(self).buttonfont = font.Font(family=buttonfont['family'],
                                              weight='bold',
                                              size=4 * buttonfont['size'])
            plus.destroy()

        self.plus = tk.Button(self.tab,
                              text="+",
                              font=type(self).buttonfont,
                              command=self.plusbutton)
        self.plus_menu.MenuMake(self.plus)
        self.plus.bind("<Button-3>", self.plus_menu.pop)

        self.minus = tk.Button(self.tab,
                               text="-",
                               font=type(self).buttonfont,
                               command=self.minusbutton)
        self.minus_menu.MenuMake(self.minus)
        self.minus.bind("<Button-3>", self.minus_menu.pop)

        self.plus.pack(expand=1, fill="y", padx=2, pady=2, side="right")
        self.minus.pack(expand=1, fill="y", padx=2, pady=2, side="left")
        self.scale.pack(expand=1, fill="both", padx=5, pady=5)
        self.combo.pack(expand=1, side="bottom", fill="x", padx=5, pady=5)
Пример #12
0
    def __init__(self, Root):
        #sets size of window on open
        Root.geometry('750x600')

        #Frame is set to use Pack method, to fill space across with a border
        self.topFrame = ttk.Frame(Root)
        self.topFrame.pack(fill = BOTH)
        self.topFrame.config(relief = SOLID)



        #Text input to take the input from user, each column relates to a physical column for the arm
        y = 0
        for z in range(1):
            label = ttk.Label(self.topFrame, text = "Platforms")
            label.grid(row = 2, column = 0, columnspan = 1)

            for x in range(6):
                w = Spinbox(self.topFrame, from_= 0, to = 4, state = 'readonly')
                if x < 3:
                    w.grid(row = z+2, column = x+1, columnspan = 1, padx = 10, pady = 10)
                else:
                    w.grid(row = z+4, column = y+1, columnspan = 1, padx = 10, pady = 10)
                    y = y + 1
                Spinboxes.append(w)
            y = 0
        y = 0
        z = 0

        #loop to place all the labels for the columns above the input
        for x in blocks:
            label = ttk.Label(self.topFrame, text = x)

            if y < 3:
                label.grid(row = 1, column = y+1, columnspan = 1)

            else:
                label.grid(row = 3, column = z+1, columnspan = 1)
                z = z + 1
            labels.append(label)
            y = y + 1

        #user selects the placement of the final column
        label2 = ttk.Label(self.topFrame, text = "Final Column")
        label2.grid(row = 6, column = 0, columnspan = 1)
        labelCol.append(label2)

        finalColumn = Spinbox(self.topFrame, from_= 0, to = 4, state = 'readonly')
        finalColumn.grid(row = 6, column = 1, columnspan = 1, pady=40)

        finalCol.append(finalColumn)

        #Padding prevents frame from collapsing around button
        self.topFrame.config(padding = (30,50))



        #Frame will show err messages
        self.middleFrame = ttk.Frame(Root)
        self.middleFrame.pack(fill = BOTH)
        self.middleFrame.config(relief = SOLID)
        label3 = ttk.Label(self.middleFrame, text = "")
        label3.grid(row = 0, column = 0, columnspan = 1)
        labelCol.append(label3)


        self.middleFrame.config(padding = (15,15))

        #Frame is directly under topframe by order of pack methods called
        self.botomFrame = ttk.Frame(Root)
        self.botomFrame.pack(fill = BOTH)
        self.botomFrame.config(relief = SOLID)

        #reset, run and display setup buttons
        reset = ttk.Button(self.botomFrame, text = 'reset', command = resetGrid)
        reset.grid(row = 0, column = 0, columnspan = 1, padx = 15)

        run = ttk.Button(self.botomFrame, text = 'run', command = InitRunArm)
        run.grid(row = 0, column = 2, columnspan = 1, padx = 15)



        showSetup = ttk.Button(self.botomFrame, text = 'view setup', command = CanvasSetup)
        showSetup.grid(row = 0, column = 4, columnspan = 1, padx = 15)

        visSol = ttk.Button(self.botomFrame, text = 'view generated solution', command = IsCanvSolPossible)
        visSol.grid(row = 0, column = 6, columnspan = 1, padx = 15)
        
        self.botomFrame.config(padding = (30,50))
Пример #13
0
def CanvasSolution():
    
    
    window = Toplevel(root)
    window.title("Block Solution")
    window.geometry('600x600')

    #scrollbar, tkinter does not have a default scrollbar for the frame or window
    #this code allows the window to scroll by using a frame embedded in a canvas
    #to allow scroll functionality
    scr = ttk.Scrollbar(window, orient=VERTICAL)
    MainCanvas = Canvas(window,scrollregion=(0, 0, 0, 4750), yscrollcommand=scr.set)
    MainFrame = Frame(MainCanvas, background="lightgrey")
    scr['command'] = MainCanvas.yview

    #placement of the canvas and scrollbar
    MainCanvas.grid(column=0, row=0, sticky=(N,W,E,S))
    scr.grid(column=1, row=0, sticky=(N,S))
    window.grid_columnconfigure(0, weight=1)
    window.grid_rowconfigure(0, weight=1)
    MainCanvas.create_window((0,0),window=MainFrame,anchor='nw')
    
    
    
    
    movesArr = []
    itemArr= []
    i = 6
    levOne = 0
    levTwo = 0
    levThree = 0
    levFour = 0

    #a loop to create a reference to where the blocks are currently positioned,
    #that reference will be updated for future positions
    for x in reversed(Spinboxes):
        CanvasRect.append(x.get())

        if int(x.get()) == 1:
            levOne = levOne + 1
            itemArr.append([i,int(x.get()), levOne])
            
        elif int(x.get()) == 2:
            levTwo = levTwo + 1
            itemArr.append([i,int(x.get()), levTwo])
            
        elif int(x.get()) == 3:
            levThree = levThree + 1
            itemArr.append([i,int(x.get()), levThree])
            
        elif int(x.get()) == 4:
            levFour = levFour + 1
            itemArr.append([i,int(x.get()), levFour])
        i = i - 1
        

    #read from the generated solution, then split the solution into its steps, then sort the solution
    
    file = open("final_sol.txt", "r")
    movesArrRaw = file.read().split()
    file.close()
    i = 0
    
    
    for i in range(len(movesArrRaw)):
        
        if movesArrRaw[i].startswith("(", 12, 13):
            x = movesArrRaw[i].strip("moveCellCell() ").split(",")
            for j in range(len(x)):
                x[j] = int(x[j])
            movesArr.append( x )
            
   
    movesArr.sort()


    #make the inital canvas and use initial input 
    labelText = "Starting Position: "
    label = ttk.Label(MainFrame, text = labelText)
    label.grid(row = 0, column = 0, columnspan = 1)
    graphInt = Canvas(MainFrame, width=400, height=250)
    graphInt.grid(row = 0, column = 1, columnspan = 1, padx=(5,5), pady=(5,5))
    makeCanvasStart(graphInt)
    
    CanvasRect.clear()

    #through all the generated steps, all func to calc the new position,create a canvas,
    #call func to draw the position of blocks
    for i in range(len(movesArr)):
        
        newPosition(movesArr[i], itemArr)
        text = "Arm decision "
        labelText = text + str(i) + ":"
        label = ttk.Label(MainFrame, text = labelText)
        label.grid(row = i +1, column = 0, columnspan = 1)
        graphInt = Canvas(MainFrame, width=400, height=250)
        graphInt.grid(row = i + 1, column = 1, columnspan = 1, padx=(5,5), pady=(5,5))
        makeCanvasStart(graphInt)
        CanvasRect.clear()
Пример #14
0
    "Light Plus": ("#474747", "#e0e0e0"),
    "Dark": ("#c4c4c4", "#2d2d2d"),
    "Monokai": ("#d3b774", "#474747"),
    "Night Blue": ("#ededed", "#6b9dc2")
}

# cascade (show menus)
main_menu.add_cascade(label="File", menu=file)
main_menu.add_cascade(label="Edit", menu=edit)
main_menu.add_cascade(label="View", menu=view)
main_menu.add_cascade(label="Color Theme", menu=color_theme)

#------------------End main menu--------------#

###################toolbar ################
toolbar = ttk.Label(application)
toolbar.pack(side=tk.TOP, fill=tk.X)

# font_box
font_tuples = tk.font.families()
user_font_store = tk.StringVar()
font_box = ttk.Combobox(toolbar,
                        width=30,
                        textvariable=user_font_store,
                        state="readonly")
font_box["values"] = font_tuples
font_box.current(font_tuples.index("Arial"))
font_box.grid(row=0, column=0, padx=5)

# size box
user_fontsize_select = tk.IntVar()
Пример #15
0
    def __init__(self, win):
        ttk.Frame.__init__(self, win)
        frame_left = ttk.Frame(self)
        frame_right1 = ttk.Frame(self)
        frame_right2 = ttk.Frame(self)
        # frame作为框架

        win.title("车牌识别")
        screenwidth = self.winfo_screenwidth()
        screenheight = self.winfo_screenheight()
        size = '%dx%d+%d+%d' % (950, 700, (screenwidth - 950) / 2, (screenheight - 700) / 2)
        # 设置页面大小 居中显示

        print(size)
        win.geometry(size)
        win.minsize(950,700)
        self.pack(fill=tk.BOTH, expand=tk.YES, padx="10", pady="10")
        # padx是上下对称 pady是左右对齐
        # 摆放控件位置
        frame_left.pack(side=LEFT, expand=1, fill=BOTH)
        # fill是填充样式both是横向纵向都填充 expand 1/yes表示中心 0/no表示不能扩展
        # 当side = "left"或side = "right"时,fill = "x"不起作用,只能填充y
        # side =“top”, side = "bottom"时,fill = "y"不起作用,只能填充x

        # side: 按扭停靠在窗口的哪个位置left: 左 top: 上 right: 右 botton: 下
        #   fill: 填充 x: 水平方向填充 y: 竖直方向填充  both: 水平和竖直方向填充 none: 不填充
        #   expand:yes: 扩展整个空白区   no: 不扩展
        #   anchor: N: 北  下   E: 东  右 S: 南  下 W: 西  左 CENTER: 中间
        #   padx: x方向的外边距 pady: y方向的外边距   ipadx: x方向的内边距  ipady:y方向的内边距
        from_pic_ctl = ttk.Button(frame_right2, text="来自图片", width=20, command=self.from_pic)
        from_img_pre = ttk.Button(frame_right2, text="查看形状预处理图像", width=20, command=self.show_img_pre)

        from_pic_ctl.pack(anchor="se", pady="5")
        from_img_pre.pack(anchor="se", pady="5")
        # anchor 可以设置9各参数 表示方向


        frame_right1.pack(side=TOP, expand=1, fill=tk.Y)
        frame_right2.pack(side=RIGHT, expand=0)
        ttk.Label(frame_left, text='原图:').pack(anchor="nw")
        self.image_ctl = ttk.Label(frame_left)
        self.image_ctl.pack(anchor="nw")
        # 图片展示

        ttk.Label(frame_right1, text='轮廓定位车牌位置:').grid(column=0, row=0, sticky=tk.W)

        self.roi_ctl = ttk.Label(frame_right1)
        print("ct1", self.roi_ctl)
        self.roi_ctl.grid(column=0, row=1, sticky=tk.W)
        # grid 列 行 位置

        ttk.Label(frame_right1, text='轮廓定位识别结果:').grid(column=0, row=2, sticky=tk.W)
        self.r_ctl = ttk.Label(frame_right1, text="", font=('Times', '20'),)
        self.r_ctl.grid(column=0, row=3, sticky=tk.W)
        self.color_ctl = ttk.Label(frame_right1, text="", width="20")
        ttk.Label(frame_right1, text='车牌颜色:').grid(column=0, row=4, sticky=tk.W)
        self.color_ctl.grid(column=0, row=5, sticky=tk.W)


        ttk.Label(frame_right1, text='颜色定位车牌位置:').grid(column=0, row=6, sticky=tk.W)
        self.roi_ct2 = ttk.Label(frame_right1)
        print("ct2",self.roi_ct2)
        self.roi_ct2.grid(column=0, row=7, sticky=tk.W)
        ttk.Label(frame_right1, text='颜色定位识别结果:').grid(column=0, row=8, sticky=tk.W)
        self.r_ct2 = ttk.Label(frame_right1, text="",font=('Times', '20'))
        self.r_ct2.grid(column=0, row=9, sticky=tk.W)
        self.color_ct2 = ttk.Label(frame_right1, text="",width="20")
        ttk.Label(frame_right1, text='车牌颜色:').grid(column=0, row=10, sticky=tk.W)
        self.color_ct2.grid(column=0, row=11, sticky=tk.W)

        self.predictor = predict.CardPredictor()
        self.predictor.train_svm()
Пример #16
0
    selected_song = playlistbox.curselection()
    selected_song = int(selected_song[0])
    playlistbox.delete(selected_song)
    playlist.pop(selected_song)


delBtn = ttk.Button(leftframe, text="- Del", command=del_song)
delBtn.pack(side=LEFT)

rightframe = Frame(root)
rightframe.pack(pady=30)

topframe = Frame(rightframe)
topframe.pack()

lengthlabel = ttk.Label(topframe, text='Total Length : --:--')
lengthlabel.pack(pady=5)

currenttimelabel = ttk.Label(topframe,
                             text='Current Time : --:--',
                             relief=GROOVE)
currenttimelabel.pack()


def show_details(play_song):
    global clip, t1
    file_data = os.path.splitext(play_song)
    types = ['.mp4', '.mov', '.mpg', '.wmv', '.rm']
    if file_data[1].lower() in types:
        clip = mp.VideoFileClip(play_song)
        total_length = clip.duration
Пример #17
0
    # Updating progress_message label
    if entries_changed > 0:
        progress_message.set("Success!")
        if errors > 0:
            progress_message.set(
                "Successfully inputted some cells, check error log.")
    elif entries_changed == 0:
        progress_message.set("None of the cells changed, check error.txt!")

    # Close file i/o
    fpr.close()
    fp_err.close()


# GOOGLE_SHEETS_FILENAME
ttk.Label(root, text="What is the spreadsheet name?:").pack()
spreadsheet_name = StringVar()
spreadsheet_name.trace_add("write", retrieve_spreadsheet_name)
spreadsheet_name_entry = Entry(root, width=50, textvariable=spreadsheet_name)
spreadsheet_name_entry.pack()

# CELL_COL
ttk.Label(root, text="Which column are we modifying? (Enter a letter):").pack()
cell_col = StringVar()
cell_col.trace_add("write", retrieve_cell_col)
cell_col_entry = Entry(root, width=8, textvariable=cell_col)
cell_col_entry.pack()

# CELL_CONTENT
ttk.Label(root, text="How many points do you want to input:").pack()
cell_content = StringVar()
Пример #18
0
    def __init__(self):

        # chromatograph data
        self.chromatograph_data = ChromatographData()

        # application interface
        self.root = Tk()
        self.root.title(APP_INFO)

        self.menubar = Menu(self.root)

        self.menu_file = Menu(self.menubar, tearoff=0)
        self.menu_file.add_command(label="Exit", command=self.root.quit)

        self.menu_edit = Menu(self.menubar, tearoff=0)
        self.menu_edit.add_command(label="Clear text", command=self.clear_text)
        self.menu_edit.add_command(label="Forget all data",
                                   command=self.forget_all_data)

        self.menu_info = Menu(self.menubar, tearoff=0)
        self.menu_info.add_command(label="About",
                                   command=self.show_about_window)

        self.menubar.add_cascade(label="File", menu=self.menu_file)
        self.menubar.add_cascade(label="Edit", menu=self.menu_edit)
        self.menubar.add_cascade(label="Info", menu=self.menu_info)
        self.root.config(menu=self.menubar)

        self.frame_left = ttk.Frame(self.root, relief=RAISED)
        self.frame_right = ttk.Frame(self.root, relief=RAISED)
        self.root.columnconfigure(0, weight=0)
        self.root.columnconfigure(1, weight=5)
        self.root.rowconfigure(0, weight=1)

        self.frame_left.grid(row=0, column=0, sticky='snew')
        self.frame_right.grid(row=0, column=1, sticky='snew')
        self.frame_right.rowconfigure(0, weight=1)
        self.frame_right.columnconfigure(0, weight=1)
        self.frame_right.rowconfigure(1, weight=0)
        self.frame_right.columnconfigure(1, weight=0)

        self.button_generate_data = ttk.Button(self.frame_left,
                                               text="Generate data",
                                               command=self.generate_data)
        self.button_generate_data.grid(row=0,
                                       column=0,
                                       padx=25,
                                       pady=15,
                                       sticky='snew')
        self.button_save_spreadsheet = ttk.Button(
            self.frame_left,
            text="Save spreadsheet",
            command=self.save_spreadsheet)
        self.button_save_spreadsheet.grid(row=1,
                                          column=0,
                                          padx=25,
                                          pady=5,
                                          sticky='snew')
        self.label_tmx_serial_no = ttk.Label(self.frame_left,
                                             text="TMx serial no.:")
        self.label_tmx_serial_no.grid(row=2, column=0)
        self.entry_tmx_serial_no = ttk.Entry(self.frame_left)
        self.entry_tmx_serial_no.grid(row=3, column=0)

        self.text_data = Text(self.frame_right)
        self.text_data.grid(row=0, column=0, sticky='snew')
        self.y_scrollbar = ttk.Scrollbar(self.frame_right,
                                         orient=VERTICAL,
                                         command=self.text_data.yview)
        self.y_scrollbar.grid(row=0, column=1, sticky='sn')
        self.x_scrollbar = ttk.Scrollbar(self.frame_right,
                                         orient=HORIZONTAL,
                                         command=self.text_data.xview)
        self.x_scrollbar.grid(row=1, column=0, sticky='ew')
        self.text_data.configure(xscrollcommand=self.x_scrollbar.set,
                                 yscrollcommand=self.y_scrollbar.set)

        self.add_status_string(APP_INFO)

        self.root.mainloop()
Пример #19
0
import tkinter as tk
from tkinter import ttk
import webbrowser

root = tk.Tk()
root.title('Universal Search Bar')

label1 = ttk.Label(root, text='Query')
label1.grid(row=0, column=0)
entry1 = ttk.Entry(root, width=50)
entry1.grid(row=0, column=1)

def callback():
    webbrowser.open('http://google.com/search?q='+entry1.get())

def get(event):
    webbrowser.open('http://google.com/search?q='+entry1.get())
    
Пример #20
0
    def __init__(self, *args, **kwargs):
        FrameLifts.__init__(self, *args, **kwargs)

        self.winfo_toplevel().title("Select Hazard Type")
        self.winfo_toplevel().wm_geometry(
            "%dx%d" %
            (guiWindow_HazardMenu_Width, guiWindow_HazardMenu_Height))

        # Create GUI window frame for Hazard Menu widgets and buttons.
        self.winFrame = tkinter.Frame(self)
        self.winFrame.grid(column=0, row=0, padx=0, pady=0)

        # Frame for icon frame within winFrame.
        iconFrame = ttk.Frame(self.winFrame)
        iconFrame.grid(column=0, row=0, padx=25, pady=10)

        # UT-Dallas GIF logo used within the GUI.
        dirFolder = os.path.dirname(__file__)
        gifPath = os.path.join(dirFolder, "Icon_UTD.gif")
        self.photo_UTDallas_Icon = tkinter.PhotoImage(file=gifPath)
        colorCode_UTD_Orange = "#C75B12"
        self.subSampleImage = self.photo_UTDallas_Icon.subsample(4, 4)
        self.label_for_icon = ttk.Label(iconFrame,
                                        borderwidth=2,
                                        relief="solid",
                                        background=colorCode_UTD_Orange,
                                        image=self.subSampleImage)
        self.label_for_icon.photo = self.photo_UTDallas_Icon
        self.label_for_icon.grid(column=0,
                                 row=0,
                                 padx=0,
                                 pady=0,
                                 sticky=tkinter.EW)

        # Frame for widgets within winFrame.
        widgetFrame = ttk.Frame(self.winFrame)
        widgetFrame.grid(column=0, row=1, padx=25, pady=10)

        # Adding a label to widgetFrame.
        widgetLabel_HazardTypes = \
            ttk.Label(widgetFrame,text="Please select hazard type:  ")
        widgetLabel_HazardTypes.grid(column=0, row=1, padx=0, pady=0)

        # Creating/adding the combobox to the widgetFrame.
        self.stringHazardTypes = tkinter.StringVar()
        widgetCombo_HazardTypes = ttk.Combobox(
            widgetFrame,
            width=14,
            textvariable=self.stringHazardTypes,
            state="readonly")
        widgetCombo_HazardTypes["values"] = (hazardValues)
        widgetCombo_HazardTypes.grid(column=1, row=1, padx=0, pady=0)

        # Display first index of hazardValues list.
        widgetCombo_HazardTypes.current(0)

        # Frame for buttons within winFrame.
        buttonFrame = ttk.Frame(self.winFrame)
        buttonFrame.grid(column=0, row=2, padx=0, pady=10)

        # Exit button ends the application.
        buttonExit = \
            ttk.Button(buttonFrame,text="Exit",command=self.func_ExitClick)
        buttonExit.grid(column=0, row=1, padx=15, pady=0)

        # Next button takes combobox selection and proceeds to affiliated GUI.
        buttonNext = \
            ttk.Button(buttonFrame,text="Next",command=self.func_NextClick)
        buttonNext.grid(column=1, row=1, padx=15, pady=0)
Пример #21
0
def init(start_open: bool, log_level: str = 'info') -> None:
    """Initialise the window."""
    global log_handler, text_box, level_selector

    window.columnconfigure(0, weight=1)
    window.rowconfigure(0, weight=1)
    window.title(_('Logs - {}').format(utils.BEE_VERSION))
    window.protocol('WM_DELETE_WINDOW', lambda: set_visible(False))

    text_box = tk.Text(
        window,
        name='text_box',
        width=50,
        height=15,
    )
    text_box.grid(row=0, column=0, sticky='NSEW')

    log_level = logging.getLevelName(log_level.upper())

    log_handler = TextHandler(text_box)

    try:
        log_handler.setLevel(log_level)
    except ValueError:
        log_level = logging.INFO
    log_handler.setFormatter(
        logging.Formatter(
            # One letter for level name
            '[{levelname[0]}] {module}.{funcName}(): {message}',
            style='{',
        ))

    logging.getLogger().addHandler(log_handler)

    scroll = tk_tools.HidingScroll(
        window,
        name='scroll',
        orient=tk.VERTICAL,
        command=text_box.yview,
    )
    scroll.grid(row=0, column=1, sticky='NS')
    text_box['yscrollcommand'] = scroll.set

    button_frame = ttk.Frame(window, name='button_frame')
    button_frame.grid(row=1, column=0, columnspan=2, sticky='EW')

    ttk.Button(
        button_frame,
        name='clear_btn',
        text='Clear',
        command=btn_clear,
    ).grid(row=0, column=0)

    ttk.Button(
        button_frame,
        name='copy_btn',
        text=_('Copy'),
        command=btn_copy,
    ).grid(row=0, column=1)

    sel_frame = ttk.Frame(button_frame, )
    sel_frame.grid(row=0, column=2, sticky='EW')
    button_frame.columnconfigure(2, weight=1)

    ttk.Label(
        sel_frame,
        text=_('Show:'),
        anchor='e',
        justify='right',
    ).grid(row=0, column=0, sticky='E')

    level_selector = ttk.Combobox(
        sel_frame,
        name='level_selector',
        values=[LVL_TEXT[level] for level in BOX_LEVELS],
        exportselection=0,
        # On Mac this defaults to being way too wide!
        width=15 if utils.MAC else None,
    )
    level_selector.state(['readonly'])  # Prevent directly typing in values
    level_selector.bind('<<ComboboxSelected>>', set_level)
    level_selector.current(BOX_LEVELS.index(log_level))

    level_selector.grid(row=0, column=1, sticky='E')
    sel_frame.columnconfigure(1, weight=1)

    utils.add_mousewheel(text_box, window, sel_frame, button_frame)

    if utils.USE_SIZEGRIP:
        ttk.Sizegrip(button_frame).grid(row=0, column=3)

    if start_open:
        window.deiconify()
        window.lift()
        # Force an update, we're busy with package extraction...
        window.update()
    else:
        window.withdraw()
Пример #22
0
    def __init__(self, parent, row=2, col=0):
        ttk.Frame.__init__(self, parent)
        self.grid(row=row, column=col, pady=10)
        self.parent = parent

        title = ttk.Label(self,
                          text="Enviroment options",
                          font=("Helvetica", 16),
                          justify="center")
        title.grid(row=row, column=col, columnspan=2)

        self.job = self.parent.job

        #######################################################################
        #            Path to where job DQS files will be produced
        #######################################################################
        self.jobsavepath = StringVar()
        self.jobsavepath.set(self.job.save_path)

        a = ttk.Button(self,
                       text="Select Save Folder",
                       width=15,
                       command=self.setSavePathWithPrompt)
        a.grid(row=row + 1, column=col, pady=5, sticky=W)

        b = ttk.Entry(self, textvariable=self.jobsavepath, width=25)
        b.grid(row=row + 1, column=col + 1, pady=5, sticky=W + E)

        #######################################################################
        #            Path to where the current template is located
        #######################################################################
        self.tmpltpath = StringVar(self)
        self.tmpltpath.set(self.job.template_path)
        self.tmpltpath.trace("w", self.setTemplatePath)

        c = ttk.Button(self,
                       text="Select template",
                       width=15,
                       command=self.setTemplatePathWithPrompt)
        c.grid(row=row + 2, column=col, pady=5, sticky=W)

        d = ttk.Entry(self, textvariable=self.tmpltpath, width=25)
        d.grid(row=row + 2, column=col + 1, pady=5, sticky=W + E)

        #######################################################################
        #            Path to where the results will be saved on the cluster
        #######################################################################
        respathl = ttk.Label(self, text="Results save folder: ")
        respathl.grid(row=row + 6, column=col, pady=3, sticky=W)

        self.respath = ttk.Entry(self)
        self.respath.insert(0, self.job.res_path)
        self.respath.grid(row=row + 6, column=col + 1, pady=3, sticky=W + E)

        #######################################################################
        #            Edit template
        #######################################################################
        e = ttk.Button(self,
                       text="Edit template",
                       width=15,
                       command=self.editTemplate)
        e.grid(row=row + 3, column=col, pady=5, sticky=W + E)

        self.savetmpbtn = ttk.Button(self,
                                     text="Save template",
                                     width=15,
                                     state=DISABLED,
                                     command=self.saveTemplate)
        self.savetmpbtn.grid(row=row + 3, column=col + 1, pady=5, sticky=W + E)
Пример #23
0
    def __init__(self,
                 parent=None,
                 message='Select one of the following:',
                 title='Single Choice Dialog',
                 choice_list=['default list', 'put your own list here'],
                 box_height=10,
                 box_width=50):
        """  Contructor for SingleChoiceDialog

            parent: tkinter.Frame, parent Frame or main Frame of
            the application.

            message: str, message label to inform user to pick one
            item on the list

            title: str, dialog box's window title

            choice_list: list, list of items to be picked.

                items = ['Red', 'Blue', 'Yellow', 'Green'] or

                items = [1, 2, 3] or

                items = [(1, 'fish'), (2, 'boat'), (3, 'hut')]


        """
        super().__init__(parent)

        self.title(title)
        self.resizable(False, False)
        # intercept close button
        self.protocol('WM_DELETE_WINDOW', self.btn_cancel)
        self.bind('<Return>', self.btn_ok)
        self.bind('<Escape>', self.btn_cancel)

        x = (self.winfo_screenwidth() - self.winfo_reqwidth()) // 2
        y = (self.winfo_screenheight() - self.winfo_reqheight()) // 3
        self.geometry(f"+{x}+{y}")

        dialog_frame = ttk.Frame(self)
        dialog_frame.pack(padx=20, pady=5)
        ttk.Label(dialog_frame, text=message).pack()

        # list box
        lstbox_frame = ttk.Frame(self)
        lstbox_frame.pack()
        scrollbar = ttk.Scrollbar(lstbox_frame)
        scrollbar.pack(padx=(0, 15), side=tk.RIGHT, fill=tk.BOTH)
        lst_len = len(choice_list)
        if lst_len > box_height:
            lbox_height = box_height
        elif lst_len < 3:
            lbox_height = 3  # improve the matching scrollbar to list box
        else:
            lbox_height = lst_len
        list_items = tk.StringVar(self, value=choice_list)
        self.listbox = tk.Listbox(lstbox_frame,
                                  height=lbox_height,
                                  width=box_width,
                                  listvariable=list_items)

        self.listbox.pack(padx=(15, 0))
        self.listbox.config(yscrollcommand=scrollbar.set)
        scrollbar.config(command=self.listbox.yview)
        self.listbox.selection_set(0)  # set selection at 0 index by default
        self.listbox.focus_set()  # put focus on list box

        # Binding double click with left mouse
        # button with go function
        self.listbox.bind('<Double-1>', self.go)

        ttk.Separator(self, orient=tk.HORIZONTAL).pack(padx=15,
                                                       pady=10,
                                                       fill=tk.X)

        button_frame = ttk.Frame(self)
        button_frame.pack(padx=15, anchor='e')

        ttk.Button(button_frame,
                   text='OK',
                   default=tk.ACTIVE,
                   command=self.btn_ok).pack(side=tk.RIGHT)

        ttk.Button(button_frame, text='Cancel',
                   command=self.btn_cancel).pack(padx=3, side=tk.RIGHT)

        # init
        self.selected = None

        self.transient(parent)  # dialog window is related to main
        self.wait_visibility()  # can't grab until window appears, so we wait
        self.grab_set()  # ensure all input goes to our window
Пример #24
0
    def __init__(self, json_str, runner, master=None):
        # first make sure that the json data has the correct fields
        j = json.loads(json_str)
        self.name = j['name']
        self.description = j['description']
        self.flag = j['flags'][len(j['flags']) - 1]
        self.parameter_type = j['parameter_type']
        self.file_type = j['parameter_type']['ExistingFileOrFloat']
        self.optional = j['optional']
        default_value = j['default_value']

        self.runner = runner

        ttk.Frame.__init__(self, master)
        self.grid()
        self['padding'] = '0.1i'

        self.label = ttk.Label(self, text=self.name, justify=tk.LEFT)
        self.label.grid(row=0, column=0, sticky=tk.W)
        self.label.columnconfigure(0, weight=1)

        if not self.optional:
            self.label['text'] = self.label['text'] + "*"

        fs_frame = ttk.Frame(self, padding='0.0i')
        self.value = tk.StringVar()
        self.entry = ttk.Entry(fs_frame,
                               width=35,
                               justify=tk.LEFT,
                               textvariable=self.value)
        self.entry.grid(row=0, column=0, sticky=tk.NSEW)
        self.entry.columnconfigure(0, weight=1)
        if default_value:
            self.value.set(default_value)

        # self.img = tk.PhotoImage(file=script_dir + "/img/open.gif")
        # self.open_button = ttk.Button(fs_frame, width=55, image=self.img, command=self.select_dir)
        self.open_button = ttk.Button(fs_frame,
                                      width=4,
                                      text="...",
                                      command=self.select_file)
        self.open_button.grid(row=0, column=1, sticky=tk.E)
        # self.open_button.columnconfigure(0, weight=1)

        self.label = ttk.Label(fs_frame, text='OR', justify=tk.LEFT)
        self.label.grid(row=0, column=2, sticky=tk.W)
        # self.label.columnconfigure(0, weight=1)

        self.value2 = tk.StringVar()
        self.entry2 = ttk.Entry(fs_frame,
                                width=10,
                                justify=tk.LEFT,
                                textvariable=self.value2)
        self.entry2.grid(row=0, column=3, sticky=tk.NSEW)
        self.entry2.columnconfigure(0, weight=1)
        self.entry2['justify'] = 'right'

        fs_frame.grid(row=1, column=0, sticky=tk.NSEW)
        fs_frame.columnconfigure(0, weight=10)
        fs_frame.columnconfigure(1, weight=1)
        # self.pack(fill=tk.BOTH, expand=1)
        self.columnconfigure(0, weight=1)
        self.rowconfigure(0, weight=1)
        self.rowconfigure(1, weight=1)

        # Add the bindings
        if _platform == "darwin":
            self.entry.bind("<Command-Key-a>", self.select_all)
        else:
            self.entry.bind("<Control-Key-a>", self.select_all)
            opentext()
        else:
            return
    else:
        opentext()


# Creating tkinter window
window = tk.Tk()
window.geometry('')
window.title("Mozilla TTS GUI")
window.resizable(False, False)
# Label
ttk.Label(window, text="Enter text here",
          font=("Tahoma", 10)).grid(column=0,
                                    columnspan=3,
                                    row=12,
                                    padx=10,
                                    pady=12)

# Text
inputbox = scrolledtext.ScrolledText(window, height=15, width=70, undo=True)
inputbox.grid(column=0, columnspan=3, row=13, padx=10, pady=12)

# Label
ttk.Label(window, text="Select the tts_model",
          font=("Tahoma", 10)).grid(column=0, row=14, padx=10, pady=12)

n = tk.StringVar()
ttsmodelbox = ttk.Combobox(window, width=32, textvariable=n, state="readonly")
# Adding combobox drop down list
ttsmodelbox['values'] = ('en/ljspeech/glow-tts', 'en/ljspeech/tacotron2-DCA',
Пример #26
0
    def create_widgets(self):
        toplevel_frame = ttk.Frame(self, padding='0.1i')

        (self.toolslist, selected_item) = self.get_tools_list()
        self.tools_frame = ttk.LabelFrame(toplevel_frame,
                                          text="{} Available Tools".format(
                                              len(self.toolslist)),
                                          padding='0.1i')
        self.toolnames = tk.StringVar(value=self.toolslist)
        self.tools_listbox = tk.Listbox(self.tools_frame,
                                        height=22,
                                        listvariable=self.toolnames)
        self.tools_listbox.bind("<<ListboxSelect>>", self.update_tool_help)
        self.tools_listbox.grid(row=0, column=0, sticky=tk.NSEW)
        self.tools_listbox.columnconfigure(0, weight=10)
        self.tools_listbox.rowconfigure(0, weight=1)
        s = ttk.Scrollbar(self.tools_frame,
                          orient=tk.VERTICAL,
                          command=self.tools_listbox.yview)
        s.grid(row=0, column=1, sticky=(tk.N, tk.S))
        self.tools_listbox['yscrollcommand'] = s.set
        self.tools_frame.grid(row=0, column=0, sticky=tk.NSEW)
        self.tools_frame.columnconfigure(0, weight=10)
        self.tools_frame.columnconfigure(1, weight=1)
        self.tools_frame.rowconfigure(0, weight=1)

        overall_frame = ttk.Frame(toplevel_frame, padding='0.1i')

        # json_str = '{"default_value": null, "description": "Directory containing data files.", "flags": ["--wd"], "name": "Working Directory", "optional": true, "parameter_type": "Directory"}'
        # self.wd = FileSelector(json_str, overall_frame)
        # self.wd.grid(row=0, column=0, sticky=tk.NSEW)

        current_tool_frame = ttk.Frame(overall_frame, padding='0.1i')
        self.current_tool_lbl = ttk.Label(
            current_tool_frame,
            text="Current Tool: {}".format(self.tool_name),
            justify=tk.LEFT)  # , font=("Helvetica", 12, "bold")
        self.current_tool_lbl.grid(row=0, column=0, sticky=tk.W)
        self.view_code_button = ttk.Button(current_tool_frame,
                                           text="View Code",
                                           width=12,
                                           command=self.view_code)
        self.view_code_button.grid(row=0, column=1, sticky=tk.E)
        current_tool_frame.grid(row=1, column=0, sticky=tk.NSEW)
        current_tool_frame.columnconfigure(0, weight=1)
        current_tool_frame.columnconfigure(1, weight=1)

        tool_args_frame = ttk.Frame(overall_frame, padding='0.0i')
        self.tool_args_frame = ttk.Frame(overall_frame, padding='0.0i')
        self.tool_args_frame.grid(row=2, column=0, sticky=tk.NSEW)
        self.tool_args_frame.columnconfigure(0, weight=1)

        # args_frame = ttk.Frame(overall_frame, padding='0.1i')
        # self.args_label = ttk.Label(args_frame, text="Tool Arguments:", justify=tk.LEFT)
        # self.args_label.grid(row=0, column=0, sticky=tk.W)
        # args_frame2 = ttk.Frame(args_frame, padding='0.0i')
        # self.args_value = tk.StringVar()
        # self.args_text = ttk.Entry(args_frame2, width=45, justify=tk.LEFT, textvariable=self.args_value)
        # self.args_text.grid(row=0, column=0, sticky=tk.NSEW)
        # self.args_text.columnconfigure(0, weight=1)
        # self.clearButton = ttk.Button(args_frame2, text="Clear", width=4, command=self.clear_args_box)
        # self.clearButton.pack(pady=10, padx=10)
        # self.clearButton.grid(row=0, column=1, sticky=tk.E)
        # self.clearButton.columnconfigure(0, weight=1)
        # args_frame2.grid(row=1, column=0, sticky=tk.NSEW)
        # args_frame2.columnconfigure(0, weight=10)
        # args_frame2.columnconfigure(1, weight=1)
        # args_frame.grid(row=2, column=0, sticky=tk.NSEW)
        # args_frame.columnconfigure(0, weight=1)

        # # Add the bindings
        # if _platform == "darwin":
        #     self.args_text.bind("<Command-Key-a>", self.args_select_all)
        # else:
        #     self.args_text.bind("<Control-Key-a>", self.args_select_all)

        buttonsFrame = ttk.Frame(overall_frame, padding='0.1i')
        self.run_button = ttk.Button(buttonsFrame,
                                     text="Run",
                                     width=8,
                                     command=self.run_tool)
        # self.run_button.pack(pady=10, padx=10)
        self.run_button.grid(row=0, column=0)
        self.quitButton = ttk.Button(buttonsFrame,
                                     text="Cancel",
                                     width=8,
                                     command=self.cancel_operation)
        self.quitButton.grid(row=0, column=1)
        buttonsFrame.grid(row=3, column=0, sticky=tk.E)

        output_frame = ttk.Frame(overall_frame, padding='0.1i')
        outlabel = ttk.Label(output_frame, text="Output:", justify=tk.LEFT)
        outlabel.grid(row=0, column=0, sticky=tk.NW)
        k = wbt.tool_help(self.tool_name)
        self.out_text = ScrolledText(output_frame,
                                     width=63,
                                     height=10,
                                     wrap=tk.NONE,
                                     padx=7,
                                     pady=7)
        self.out_text.insert(tk.END, k)
        self.out_text.grid(row=1, column=0, sticky=tk.NSEW)
        self.out_text.columnconfigure(0, weight=1)
        output_frame.grid(row=4, column=0, sticky=tk.NSEW)
        output_frame.columnconfigure(0, weight=1)

        # Add the binding
        if _platform == "darwin":
            self.out_text.bind("<Command-Key-a>", self.select_all)
            # self.out_text.bind("<Command-Key-A>", self.select_all)
        else:
            self.out_text.bind("<Control-Key-a>", self.select_all)

        progress_frame = ttk.Frame(overall_frame, padding='0.1i')
        self.progress_label = ttk.Label(progress_frame,
                                        text="Progress:",
                                        justify=tk.LEFT)
        self.progress_label.grid(row=0, column=0, sticky=tk.E, padx=5)
        self.progress_var = tk.DoubleVar()
        self.progress = ttk.Progressbar(progress_frame,
                                        orient="horizontal",
                                        variable=self.progress_var,
                                        length=200,
                                        maximum=100)
        self.progress.grid(row=0, column=1, sticky=tk.E)
        progress_frame.grid(row=5, column=0, sticky=tk.E)

        overall_frame.grid(row=0, column=1, sticky=tk.NSEW)

        overall_frame.columnconfigure(0, weight=1)
        toplevel_frame.columnconfigure(0, weight=1)
        toplevel_frame.columnconfigure(1, weight=4)
        # self.pack(fill=tk.BOTH, expand=1)
        # toplevel_frame.columnconfigure(0, weight=1)
        # toplevel_frame.rowconfigure(0, weight=1)

        toplevel_frame.grid(row=0, column=0, sticky=tk.NSEW)

        # Select the appropriate tool, if specified, otherwise the first tool
        self.tools_listbox.select_set(selected_item)
        self.tools_listbox.event_generate("<<ListboxSelect>>")
        self.tools_listbox.see(selected_item)

        menubar = tk.Menu(self)
        filemenu = tk.Menu(menubar, tearoff=0)
        filemenu.add_command(label="Set Working Directory",
                             command=self.set_directory)
        filemenu.add_command(label="Locate WhiteboxTools exe",
                             command=self.select_exe)
        filemenu.add_command(label="Refresh Tools", command=self.refresh_tools)
        filemenu.add_separator()
        filemenu.add_command(label="Exit", command=self.quit)
        menubar.add_cascade(label="File", menu=filemenu)

        editmenu = tk.Menu(menubar, tearoff=0)
        editmenu.add_command(
            label="Cut",
            command=lambda: self.focus_get().event_generate("<<Cut>>"))
        editmenu.add_command(
            label="Copy",
            command=lambda: self.focus_get().event_generate("<<Copy>>"))
        editmenu.add_command(
            label="Paste",
            command=lambda: self.focus_get().event_generate("<<Paste>>"))

        menubar.add_cascade(label="Edit ", menu=editmenu)

        helpmenu = tk.Menu(menubar, tearoff=0)
        helpmenu.add_command(label="About", command=self.help)

        helpmenu.add_command(label="License", command=self.license)

        menubar.add_cascade(label="Help ", menu=helpmenu)

        self.master.config(menu=menubar)
Пример #27
0
    def __init__(self, scenario, AS, imp):
        super().__init__()
        self.cs = scenario
        self.AS = AS
        self.title("Manage AS")
        self.obj_type = ("trunk", "node", "edge")
        self.area_listbox = ("area names", "area trunks", "area nodes")

        self.label_name = ttk.Label(self, text="AS name")
        self.label_id = ttk.Label(self, text="AS ID")
        self.label_type = ttk.Label(self, text="AS Type")

        self.str_name = tk.StringVar()
        self.entry_name = tk.Entry(self, textvariable=self.str_name, width=10)
        self.str_name.set(AS.name)
        self.str_id = tk.StringVar()
        self.entry_id = tk.Entry(self, textvariable=self.str_id, width=10)
        self.str_id.set(AS.id)

        # the type of a domain cannot change after domain creation.
        self.AS_type = ttk.Label(self, text=AS.type)

        # interface to cost dictionnary. This is used for OSPF and IS-IS,
        # because the cost of a trunk depends on the bandwidth.
        # Trunk_cost = Ref_BW / BW
        self.if_to_cost = {
            "FE": 10**7,
            "GE": 10**8,
            "10GE": 10**9,
            "40GE": 4 * 10**9,
            "100GE": 10**10
        }

        # find edge nodes of the AS
        self.button_update_cost = ttk.Button(
            self, text="Update costs", command=lambda: self.update_cost())
        self.button_update_cost.grid(row=1,
                                     column=0,
                                     pady=5,
                                     padx=5,
                                     sticky="w")

        self.button_update_topo = ttk.Button(
            self,
            text="Update topology",
            command=lambda: self.update_AS_topology())
        self.button_update_topo.grid(row=2,
                                     column=0,
                                     pady=5,
                                     padx=5,
                                     sticky="w")

        self.label_name.grid(row=0, column=2, pady=5, padx=5, sticky="e")
        self.label_id.grid(row=1, column=2, pady=5, padx=5, sticky="e")
        self.label_type.grid(row=2, column=2, pady=5, padx=5, sticky="e")
        self.entry_name.grid(row=0, column=4, pady=5, padx=5, sticky="w")
        self.entry_id.grid(row=1, column=4, pady=5, padx=5, sticky="w")
        self.AS_type.grid(row=2, column=4, pady=5, padx=5, sticky="w")

        # listbox of all AS objects
        self.dict_listbox = {}
        for index, type in enumerate(self.obj_type):
            lbl = tk.Label(self,
                           bg="#A1DBCD",
                           text="".join(("AS ", type, "s")))
            listbox = ObjectListbox(self,
                                    activestyle="none",
                                    width=15,
                                    height=7,
                                    selectmode="extended")
            self.dict_listbox[type] = listbox
            yscroll = tk.Scrollbar(self,
                                   command=self.dict_listbox[type].yview,
                                   orient=tk.VERTICAL)
            listbox.configure(yscrollcommand=yscroll.set)
            listbox.bind("<<ListboxSelect>>",
                         lambda e, type=type: self.highlight_object(e, type))
            lbl.grid(row=3, column=2 * index)
            listbox.grid(row=4, column=2 * index)
            yscroll.grid(row=4, column=1 + 2 * index, sticky="ns")

        # populate the listbox with all objects from which the AS was created
        for obj_type in ("trunk", "node", "edge"):
            for obj in AS.pAS[obj_type]:
                self.dict_listbox[obj_type].insert(obj)

        # listbox for areas
        for index, type in enumerate(self.area_listbox):
            lbl = tk.Label(self, bg="#A1DBCD", text=type.title())
            listbox = ObjectListbox(self,
                                    activestyle="none",
                                    width=15,
                                    height=7)
            self.dict_listbox[type] = listbox
            yscroll = tk.Scrollbar(self,
                                   command=self.dict_listbox[type].yview,
                                   orient=tk.VERTICAL)
            listbox.configure(yscrollcommand=yscroll.set)
            if type == "area names":
                listbox.bind("<<ListboxSelect>>",
                             lambda e: self.display_area(e))
            else:
                listbox.bind(
                    "<<ListboxSelect>>",
                    lambda e, type=type: self.highlight_object(e, type))
            lbl.grid(row=6, column=2 * index)
            listbox.grid(row=7, column=2 * index)
            yscroll.grid(row=7, column=1 + 2 * index, sticky="ns")

        # find edge nodes of the AS
        self.button_find_edge_nodes = ttk.Button(
            self, text="Find edges", command=lambda: self.find_edge_nodes())

        self.button_create_route = ttk.Button(
            self, text="Create traffic", command=lambda: self.create_traffic())

        # find domain trunks: the trunks between nodes of the AS
        self.button_find_trunks = ttk.Button(
            self, text="Find trunks", command=lambda: self.find_trunks())

        # operation on nodes
        self.button_remove_node_from_AS = ttk.Button(
            self,
            text="Remove node",
            command=lambda: self.remove_selected("node"))

        self.button_add_to_edges = ttk.Button(
            self, text="Add to edges", command=lambda: self.add_to_edges())

        self.button_remove_from_edges = ttk.Button(
            self, text="Remove edge", command=lambda: self.remove_from_edges())

        # button to create an area
        self.button_create_area = ttk.Button(
            self, text="Create area", command=lambda: area.CreateArea(self))

        # button to delete an area
        self.button_delete_area = ttk.Button(
            self, text="Delete area", command=lambda: self.delete_area())

        # combobox for the user to change the protection type
        self.var_pct_type = tk.StringVar()
        self.pct_type_list = ttk.Combobox(self,
                                          textvariable=self.var_pct_type,
                                          width=20)
        self.pct_type_list["values"] = ("IGP convergence", "FRR ECMP",
                                        "FRR LFA")
        self.var_pct_type.set("IGP convergence")

        # combobox to choose the exit ASBR
        self.exit_asbr = tk.StringVar()
        self.router_list = ttk.Combobox(self,
                                        textvariable=self.exit_asbr,
                                        width=10)
        self.router_list["values"] = (None, ) + tuple(
            self.dict_listbox["node"].yield_all())
        self.exit_asbr.set(None)

        # buttons under the trunks column
        self.button_create_route.grid(row=5, column=0)
        self.button_find_trunks.grid(row=6, column=0)

        # button under the nodes column
        self.button_remove_node_from_AS.grid(row=5, column=2)
        self.button_add_to_edges.grid(row=6, column=2)
        self.button_remove_from_edges.grid(row=7, column=2)

        # button under the edge column
        self.button_find_edge_nodes.grid(row=5, column=4)
        self.button_remove_from_edges.grid(row=6, column=4)

        # button under the area column
        self.button_create_area.grid(row=8, column=0)
        self.button_delete_area.grid(row=9, column=0)

        # protection type drop-down list
        # self.pct_type_list.grid(row=1, column=6)

        # protection type drop-down list
        self.router_list.grid(row=10, column=0)

        # at first, the backbone is the only area: we insert it in the listbox
        self.dict_listbox["area names"].insert("Backbone")

        # hide the window when closed
        self.protocol("WM_DELETE_WINDOW", self.save_parameters)

        # if the AS is created from an import, close the management window
        if imp:
            self.withdraw()
Пример #28
0
    # Create root window.
    root = tk.Tk()
    root.title("Among Us Helper")
    root.configure(bg="#424242")
    style = ThemedStyle(root)
    style.set_theme("black")
    for row in range(3):
        root.grid_rowconfigure(row, weight=1)
    for col in range(3):
        root.grid_columnconfigure(col, weight=1)

    # Create stopwatch frame and buttons.
    stopwatch = ttk.Frame(root)
    stopwatch.grid(row=0, column=0, sticky="ew", columnspan=2)
    stopwatch_label = ttk.Label(stopwatch,
                                text="Stopwatch",
                                font="Arial 20 bold")
    stopwatch_label.pack()
    start = ttk.Button(stopwatch,
                       text='Start',
                       width=15,
                       command=lambda: Start(stopwatch_label))
    start.pack()
    stop = ttk.Button(stopwatch,
                      text='Stop',
                      width=15,
                      state='disabled',
                      command=Stop)
    stop.pack()
    reset = ttk.Button(stopwatch,
                       text='Reset',
Пример #29
0
def new_decrypt():  # new window definition
    newwin = Toplevel(root)
    newwin.geometry('850x450')
    newwin.configure(bg='grey25')
    newwin.title('MULTISTEGO')
    newwin.iconbitmap("favicon.ico")
    root.withdraw()
    display = Label(newwin, text="Decryption !", bg="grey25", fg="red")
    display.pack()
    style = ttk.Style()
    style.configure('new.TFrame', background='grey25')
    tab_parent = ttk.Notebook(newwin)
    tab1 = ttk.Frame(tab_parent, style='new.TFrame')
    tab2 = ttk.Frame(tab_parent, style='new.TFrame')
    tab3 = ttk.Frame(tab_parent, style='new.TFrame')
    tab_parent.add(tab1, text="Image")
    tab_parent.add(tab2, text="Audio")
    tab_parent.add(tab3, text="Video")

    style1 = ttk.Style()
    style1.configure("BW.TLabel", foreground="red", background="grey25")

    ttk.Label(tab1, text="Image Stegnography",
              style="BW.TLabel").grid(column=0, row=0, padx=10, pady=10)
    blank = Label(tab1,
                  text="Choose the image to retrieve data from",
                  fg="white",
                  bg="grey25").grid(column=0, row=1, padx=10, pady=10)
    selectfile = Button(tab1,
                        text="choose image",
                        command=lambda: getfile(blank1, errlabel),
                        bg="grey25",
                        fg="khaki1")
    selectfile.grid(column=1, row=1, padx=10, pady=10)
    blank1 = Label(tab1, bg="grey25")
    blank1.grid(column=2, row=1, padx=10, pady=10)
    lable2 = Label(tab1,
                   text="enter key here(integer value)",
                   fg="white",
                   bg="grey25")
    lable2.grid(column=0, row=4, padx=10, pady=10)
    ta2 = Entry(tab1, width=30, fg="white", bg="grey50")
    ta2.grid(column=1, row=4, padx=10, pady=10)
    lable1 = Label(tab1, text="Decrypted message is", fg="white", bg="grey25")
    lable1.grid(column=0, row=5, padx=10, pady=10)
    ta1 = Text(tab1,
               height=5,
               width=30,
               state="disabled",
               bg="grey50",
               fg="white")
    ta1.grid(column=1, row=5, padx=10, pady=10)
    errlabel = Label(tab1, text="", fg="red", bg='grey25')
    errlabel.grid(column=1, row=6, padx=10, pady=10)

    #varta2=int(str(E1.get()))

    #print(getattr(getfile,'imageloc'))
    b = Button(tab1,
               text="Decrypt",
               command=lambda: decrypt(ta1, ta2, blank1, errlabel),
               bg="green",
               fg="white")
    b.grid(column=1, row=7, padx=10, pady=10)

    ttk.Label(tab2, text="Audio Stegnography",
              style="BW.TLabel").grid(column=0, row=0, padx=10, pady=10)
    blanka = Label(tab2,
                   text="Choose the audio to retrieve data from",
                   fg="white",
                   bg="grey25").grid(column=0, row=1, padx=10, pady=10)
    selectfilea = Button(tab2,
                         text="choose audio",
                         command=lambda: getfile1(blank1a, errlabela),
                         bg="grey25",
                         fg="khaki1")
    selectfilea.grid(column=1, row=1, padx=10, pady=10)
    blank1a = Label(tab2, bg="grey25")
    blank1a.grid(column=2, row=1, padx=10, pady=10)
    lable2a = Label(tab2,
                    text="enter key here(integer value)",
                    fg="white",
                    bg="grey25")
    lable2a.grid(column=0, row=4, padx=10, pady=10)
    ta2a = Entry(tab2, width=30, bg="grey50", fg="white")
    ta2a.grid(column=1, row=4, padx=10, pady=10)
    lable1a = Label(tab2, text="Decrypted message is", fg="white", bg="grey25")
    lable1a.grid(column=0, row=5, padx=10, pady=10)
    ta1a = Text(tab2,
                height=5,
                width=30,
                state="disabled",
                fg="white",
                bg="grey50")
    ta1a.grid(column=1, row=5, padx=10, pady=10)
    errlabela = Label(tab2, text="", bg="grey25", fg="red")
    errlabela.grid(column=1, row=6, padx=10, pady=10)

    #varta2=int(str(E1.get()))

    #print(getattr(getfile,'imageloc'))
    ba = Button(tab2,
                text="Decrypt",
                command=lambda: auddec(ta1a, ta2a, blank1a, errlabela),
                bg="green",
                fg="white")
    ba.grid(column=1, row=7, padx=10, pady=10)
    ttk.Label(tab3, text="Video Stegnography",
              style="BW.TLabel").grid(column=0, row=0, padx=10, pady=10)
    blankv = Label(tab3,
                   text="Choose the video to retrieve data from",
                   fg="white",
                   bg="grey25").grid(column=0, row=1, padx=10, pady=10)
    selectfilev = Button(tab3,
                         text="choose video",
                         command=lambda: getfilev(blank1v, errlabelv),
                         bg="grey25",
                         fg="khaki1")
    selectfilev.grid(column=1, row=1, padx=10, pady=10)
    blank1v = Label(tab3, bg="grey25")
    blank1v.grid(column=2, row=1, padx=10, pady=10)
    lable2v = Label(tab3,
                    text="enter key here(integer value)",
                    fg="white",
                    bg="grey25")
    lable2v.grid(column=0, row=4, padx=10, pady=10)
    ta2v = Entry(tab3, width=30, bg="grey50", fg="white")
    ta2v.grid(column=1, row=4, padx=10, pady=10)
    lable1v = Label(tab3, text="Decrypted message is", fg="white", bg="grey25")
    lable1v.grid(column=0, row=5, padx=10, pady=10)
    ta1v = Text(tab3,
                height=5,
                width=30,
                state="disabled",
                bg="grey50",
                fg="white")
    ta1v.grid(column=1, row=5, padx=10, pady=10)
    errlabelv = Label(tab3, text="", bg="grey25", fg="red")
    errlabelv.grid(column=1, row=6, padx=10, pady=10)
    #varta2=int(str(E1.get()))

    #print(getattr(getfile,'imageloc'))
    bv = Button(tab3,
                text="Decrypt",
                command=lambda: viddec(ta1v, ta2v, blank1v, errlabelv),
                bg="green",
                fg="white")
    bv.grid(column=1, row=7, padx=10, pady=10)
    tab_parent.pack(expand=1, fill='both')
from checkcred import check
from tkinter import ttk
import tkinter as tk
import os

first = tk.Tk()

# Define main window
path = os.getcwd()
first.title('Enter your Credentials')
first.iconphoto(True, tk.PhotoImage(file=os.path.join(path, 'icon.png')))
first.geometry('400x300')
first.resizable(False, False)

# username, password entry widget for credentials
ttk.Label(first, text='User       ').grid(row=0, column=0)
userstr = tk.StringVar(first)
user = ttk.Entry(first, textvariable=userstr)
user.grid(row=0, column=1, ipady=5, ipadx=50)

ttk.Label(first, text='Password    ').grid(row=1, column=0)
passwordstr = tk.StringVar(first)
password = ttk.Entry(first, textvariable=passwordstr)
password.config(show='*')
password.grid(row=1, column=1, ipady=5, ipadx=50)

df_host, df_port, df_database = 'localhost', 3306, 'akash'

add = tk.Button(first,
                text='Enter the database',
                command=lambda: check().chk(user, password, userstr.get(