Esempio n. 1
0
def popup(text):
    toplevel = Toplevel()
    toplevel.configure(background="black")
    toplevel.title("Notice")

    l = Label(toplevel, text=str(text), font=(
        "Lucida Console", 16), fg="lime green", bg="black")
    l.pack()

    b = Button(toplevel, text="Close", command=toplevel.destroy,
               font=("Lucida Console", 12), fg="lime green", bg="black")
    b.pack()

    toplevel.mainloop()
Esempio n. 2
0
 def configure(self, **kwargs):
     if 'text' in kwargs:
         self.label.configure(text=kwargs.pop('text'))
     if 'image' in kwargs:
         self.label.configure(image=kwargs.pop('image'))
     if 'background' in kwargs:
         self.style.configure('tooltip.TLabel',
                              background=kwargs['background'])
     if 'foreground' in kwargs:
         fg = kwargs.pop('foreground')
         self.style.configure('tooltip.TLabel', foreground=fg)
     if 'alpha' in kwargs:
         self.attributes('-alpha', kwargs.pop('alpha'))
     Toplevel.configure(self, **kwargs)
Esempio n. 3
0
def _object_browser(parent):
    import sys
    from tkinter import Toplevel
    top = Toplevel(parent)
    top.title('Test debug object browser')
    x, y = map(int, parent.geometry().split('+')[1:])
    top.geometry('+%d+%d' % (x + 100, y + 175))
    top.configure(bd=0, bg='yellow')
    top.focus_set()
    sc = ScrolledCanvas(top, bg='white', highlightthickness=0, takefocus=1)
    sc.frame.pack(expand=1, fill='both')
    item = make_objecttreeitem('sys', sys)
    node = TreeNode(sc.canvas, None, item)
    node.update()
Esempio n. 4
0
def _object_browser(parent):  # htest #
    import sys
    from tkinter import Toplevel
    top = Toplevel(parent)
    top.title("Test debug object browser")
    width, height, x, y = list(map(int, re.split('[x+]', parent.geometry())))
    top.geometry("+%d+%d"%(x + 100, y + 175))
    top.configure(bd=0, bg="yellow")
    top.focus_set()
    sc = ScrolledCanvas(top, bg="white", highlightthickness=0, takefocus=1)
    sc.frame.pack(expand=1, fill="both")
    item = make_objecttreeitem("sys", sys)
    node = TreeNode(sc.canvas, None, item)
    node.update()
Esempio n. 5
0
def _object_browser(parent):  # htest #
    import sys
    from tkinter import Toplevel
    top = Toplevel(parent)
    top.title("Test debug object browser")
    x, y = map(int, parent.geometry().split('+')[1:])
    top.geometry("+%d+%d" % (x + 100, y + 175))
    top.configure(bd=0, bg="yellow")
    top.focus_set()
    sc = ScrolledCanvas(top, bg="white", highlightthickness=0, takefocus=1)
    sc.frame.pack(expand=1, fill="both")
    item = make_objecttreeitem("sys", sys)
    node = TreeNode(sc.canvas, None, item)
    node.update()
Esempio n. 6
0
    def MortVaisseau(self, collision, root):

        if self.vaisseau1.vaisseau == collision[0]:
            if type(self.ptsVie) == int and self.ptsVie >= 1:
                self.ptsVie = self.ptsVie - 1
                self.canne.delete(
                    self.LVies[self.ptsVie])  # Suppression du coeur de vie

            else:
                """"Il faut arrêter le jeu"""
                print("Game over")
                FenKO = Toplevel(self.root)
                FenKO.geometry('900x600')
                FenKO.configure(bg='black')

                fontStyle = TkFont.Font(family="Lucida Grande", size=40)
                fontStyle2 = TkFont.Font(family="Lucida Grande", size=20)
                labelTitre = Label(FenKO,
                                   text="GAME OVER",
                                   font=fontStyle,
                                   fg='blue',
                                   cursor='pirate',
                                   bg='black')
                labelKO = Label(FenKO,
                                text="KO c'est KO",
                                font=fontStyle2,
                                bg='black',
                                fg='blue')
                #
                buttonRetry = Button(
                    FenKO,
                    activebackground='blue',
                    activeforeground='white',
                    text="Rejouer",
                    command=lambda: [
                        FenKO.destroy(), self.retry()
                    ])  #Bouton permettant la destruction de la sous-fenêtre
                buttonQuitter = Button(FenKO,
                                       activebackground='blue',
                                       activeforeground='white',
                                       text="Quitter le jeu",
                                       command=self.root.destroy)

                #            buttonQuitter = Button(FenKO, text = "Quitter le jeu", command=self.root.destroy)

                labelTitre.pack(side='top', pady=80)
                labelKO.pack(side='top', pady=10)

                buttonQuitter.pack(side='bottom', pady=10)
                buttonRetry.pack(side='bottom', pady=10)
def showError(location, panel):

    errorWindow = Toplevel(panel)
    errorWindow.title("not found")
    errorWindow.geometry("400x50")
    errorWindow.resizable(0, 0)
    errorWindow.configure(bg='white')
    errorWindow.iconbitmap('sad-cloud.ico')

    textLabel = Label(
        errorWindow,
        text='We are sorry, we could not find {} '.format(location),
        font=(fonts.errorFont))
    textLabel.configure(bg='white')
    textLabel.pack()
Esempio n. 8
0
    def __about(self):
        '''
        None -> None

        Associated with the Help Menu.
        Creates a new window with the "About" information
        '''
        appversion = "1.5"
        appname = "Paragon GIS Analyst"
        copyright = 14 * ' ' + '(c) 2014' + 12 * ' ' + \
            'SDATO - DP - UAF - GNR\n' + 34 * ' '\
            + "No Rights Reserved... ask the code ;)"
        licence = 18 * ' ' + 'http://opensource.org/licenses/GPL-3.0\n'
        contactname = "Nuno Venâncio"
        contactphone = "(00351) 969 564 906"
        contactemail = "*****@*****.**"

        message = "Version: " + appversion + 5 * "\n"
        message0 = "Copyleft: " + copyright + "\n" + "Licença: " + licence
        message1 = contactname + '\n' + contactphone + '\n' + contactemail

        icons = os.getcwd() + os.sep + "icons" + os.sep  # path to icons
        icon = icons + "maps.ico"

        tl = Toplevel(self.master)
        tl.configure(borderwidth=5)
        tl.title("Sobre...")
        tl.iconbitmap(icon)
        tl.resizable(width=FALSE, height=FALSE)
        f1 = Frame(tl, borderwidth=2, relief=SUNKEN, bg="gray25")
        f1.pack(side=TOP, expand=TRUE, fill=BOTH)

        l0 = Label(f1,
                   text=appname,
                   fg="white",
                   bg="gray25",
                   font=('courier', 16, 'bold'))
        l0.grid(row=0, column=0, sticky=W, padx=10, pady=5)
        l1 = Label(f1, text=message, justify=CENTER, fg="white", bg="gray25")
        l1.grid(row=2, column=0, sticky=E, columnspan=3, padx=10, pady=0)
        l2 = Label(f1, text=message0, justify=LEFT, fg="white", bg="gray25")
        l2.grid(row=6, column=0, columnspan=2, sticky=W, padx=10, pady=0)
        l3 = Label(f1, text=message1, justify=CENTER, fg="white", bg="gray25")
        l3.grid(row=7, column=0, columnspan=2, padx=10, pady=0)

        button = Button(tl, text="Ok", command=tl.destroy, width=10)
        button.pack(pady=5)
Esempio n. 9
0
    def __about(self):
        '''
        None -> None

        Associated with the Help Menu.
        Creates a new window with the "About" information
        '''
        appversion = "1.6"
        appname = "EXCEL to KML Transformer"
        copyright = 14 * ' ' + '(c) 2013' + 12 * ' ' + \
            'SDATO - DP - UAF - GNR\n' + 34 * ' '\
            + "All Rights Reserved"
        licence = 18 * ' ' + 'http://opensource.org/licenses/GPL-3.0\n'
        contactname = "Nuno Venâncio"
        contactphone = "(00351) 969 564 906"
        contactemail = "*****@*****.**"

        message = "Version: " + appversion + 5 * "\n"
        message0 = "Copyright: " + copyright + "\n" + "Licença: " + licence
        message1 = contactname + '\n' + contactphone + '\n' + contactemail

        icons = os.getcwd() + os.sep + "icons" + os.sep  # path to icons
        icon = icons + "compass.ico"

        tl = Toplevel(self.master)
        tl.configure(borderwidth=5)
        tl.title("Sobre...")
        tl.iconbitmap(icon)
        tl.resizable(width=FALSE, height=FALSE)
        f1 = Frame(tl, borderwidth=2, relief=SUNKEN, bg="gray25")
        f1.pack(side=TOP, expand=TRUE, fill=BOTH)

        l0 = Label(f1, text=appname, fg="white", bg="gray25",
                   font=('courier', 16, 'bold'))
        l0.grid(row=0, column=0, sticky=W, padx=10, pady=5)
        l1 = Label(f1, text=message, justify=CENTER,
                   fg="white", bg="gray25")
        l1.grid(row=2, column=0, sticky=E, columnspan=3, padx=10, pady=0)
        l2 = Label(f1, text=message0,
                   justify=LEFT, fg="white", bg="gray25")
        l2.grid(row=6, column=0, columnspan=2, sticky=W, padx=10, pady=0)
        l3 = Label(f1, text=message1,
                   justify=CENTER, fg="white", bg="gray25")
        l3.grid(row=7, column=0, columnspan=2, padx=10, pady=0)

        button = Button(tl, text="Ok", command=tl.destroy, width=10)
        button.pack(pady=5)
Esempio n. 10
0
def clickAbout():
    toplevel = Toplevel()
    toplevel.configure(background='white')
    label1 = Label(toplevel, text=ABOUT_TEXT, height=0, width=100)
    label1.pack()
    label1.configure(background='white')
    label2 = Label(toplevel, text=DISCLAIMER, height=0, width=100)
    label2.configure(background='white')
    label2.pack()

    i = randint(0, len(rec_list))
    label3 = Label(toplevel, text=rec_list[i], fg="blue", cursor="hand2")

    label3.pack()
    label3.bind("<Button-1>", callback)
    label3.configure(background='white')
    toplevel.mainloop()
Esempio n. 11
0
 def SettingWindow(self):
     x = self.root.winfo_x()
     y = self.root.winfo_y()
     settingWinRoot = Toplevel(self.root)
     settingWinRoot.grab_set()
     settingWinRoot.resizable(False,False)
     settingWinRoot.geometry("%dx%d+%d+%d" % (500,200,x + 50,y + 50))
     settingWinRoot.title("Setting")
     settingWinRoot.iconbitmap("./icon/icon.ico")
     settingWinRoot.configure(background=self.Theme2["color2"],)
     f1 = Frame(settingWinRoot,width=450, height=500, background=self.Theme1['color3'],borderwidth=3,relief = "raised")
     f1.pack(fill =NONE, pady=20,padx=10)
     Label(f1,text="File Path:",font="bell 12 italic",bg=self.Theme1['color3'],fg="Black").place(x=10,y=20)
     self.pathLabel = Entry(f1,font="bell 10 bold")
     Button(f1,text="Select Path",command = self.askSaveDirectory,borderwidth=2,bg=self.Theme2["color3"],foreground="white").place(x=310,y=20)
     self.pathLabel.insert(0,self.filepath)
     self.pathLabel.place(x=100,y=20,height=25,width=200)
Esempio n. 12
0
class LoadingScreen():

    def __init__(self, parent):
        self.parent = parent
        self.load_screen()

    # second screen - load screen
    def load_screen(self):
        """
        This is the initial load window --- maybe separate this and put a load bar in the future
        """
        # init top level frame/window
        self.a = Toplevel(self.parent) 
        self.a.configure(background='#013A70')
        # frame/window size
        self.a.geometry("420x315")
        # get frame/window width/height
        windowWidth = self.a.winfo_reqwidth()
        windowHeight = self.a.winfo_reqheight()
        # confirm frame/window width/height
        print("Width",windowWidth,"Height",windowHeight)
        # calculate center of frame/window width/height
        positionRight = int(self.a.winfo_screenwidth()/2 - windowWidth/2)
        positionDown = int(self.a.winfo_screenheight()/2 - windowHeight/2)
        # positions frame/window
        self.a.geometry("+{}+{}".format(positionRight, positionDown))
        # init percentage of load value
        self.percentage = 0
        # load screen text
        self.title = Label(self.a, text=f"Loading...{self.percentage}", background="#013A70", foreground="white", pady=200, padx=200)
        self.title.pack()
        # call loading function
        self.loading()

    # loading calculator
    def loading(self):
        """
        Length of time load shall last
        """
        self.percentage += 10
        self.title.config(text=f"Loading... {self.percentage}", background="#013A70")
        if self.percentage == 100:
            self.a.destroy()
            return
        else:
            engine.after(100,self.loading)  
Esempio n. 13
0
    def _license(self):
        """ affiche la licence dans une nouvelle fenêtre """
        def close():
            """ ferme la fenêtre """
            self.focus_set()
            fen.destroy()

        fen = Toplevel(self, class_="BraceletGenerator")
        fen.title(_("License"))
        fen.transient(self)
        fen.protocol("WM_DELETE_WINDOW", close)
        fen.resizable(0, 0)
        fen.grab_set()
        fen.configure(bg=BG_COLOR)
        set_icon(fen)

        texte = Text(fen, width=50, height=18)
        texte.pack()
        texte.insert(
            "end",
            _("Bracelet Generator is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\n\n"
              ))
        texte.insert(
            "end",
            _("Bracelet Generator is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\n"
              ))
        texte.insert(
            "end",
            _("You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/."
              ))

        i = int(texte.index("5.end").split(".")[1])
        texte.tag_add("link", "5.%i" % (i - 29), "5.%i" % (i - 1))
        texte.tag_configure("link", foreground="#0000ff", underline=1)
        texte.tag_bind("link", "<Button - 1>",
                       lambda event: webOpen("http://www.gnu.org/licenses/"))
        texte.tag_bind("link", "<Enter>",
                       lambda event: texte.config(cursor="hand1"))
        texte.tag_bind("link", "<Leave>",
                       lambda event: texte.config(cursor=""))
        texte.configure(state="disabled", wrap="word")

        b_close = Button(fen, text=_("Close"), command=close)
        b_close.pack(side="bottom")
        b_close.focus_set()
        fen.wait_window(fen)
def messageWindow(x2,window):
    #Top Level is used to display the window at the very front in case there is already a seperate window open as reference
    win = Toplevel()
    #To restrict window geometrical size
    win.resizable(width=False, height=False)
    #To remove the unnecessary Tk() window
    win.iconify()

    win.title("Decoded Text")
    #Hex code for dark blue
    win.configure(background="#192a3d")
    Label(win, text="Decoded Text:\n", bg="#192a3d", fg="white", font=("MarvelScript", 12, "bold")).grid(row=1,
                                                                                                   column=0,
                                                                                                   sticky="N")
    Label(win, text=x2, bg="black", fg="white", font=("Sitka", 12, "bold"),wraplength=1600 ).grid(row=2,
                                                                             column=0,
                                                                             sticky="N")
    Button(win, text="Exit", width=4, command=lambda: win.destroy()).grid(row=3, column=0, sticky="E")
Esempio n. 15
0
def openTransactions(handler):
    transactionsWindow = Toplevel()
    transactionsWindow.geometry("420x420")
    transactionsWindow.resizable(False, False)
    transactionsWindow.title("Duino-Coin Wallet - Transactions")
    transactionsWindow.configure(background=backgroundColor)
    transactionsWindow.transient([root])

    # textFont2 = Font(transactionsWindow, size=12,weight="bold")
    textFont3 = Font(transactionsWindow, size=14, weight="bold")
    textFont = Font(transactionsWindow, size=12, weight="normal")

    Label(transactionsWindow,
          text="LOCAL TRANSACTIONS LIST",
          font=textFont3,
          background=backgroundColor,
          foreground=foregroundColor).pack()
    Label(transactionsWindow,
          text="This feature will be improved in the near future",
          font=textFont,
          background=backgroundColor,
          foreground=foregroundColor).pack()

    listbox = Listbox(transactionsWindow)
    listbox.pack(side=LEFT, fill=BOTH, expand=1)
    scrollbar = Scrollbar(transactionsWindow)
    scrollbar.pack(side=RIGHT, fill=BOTH)

    with sqlite3.connect(f"{resources}/wallet.db") as con:
        cur = con.cursor()
        cur.execute("SELECT rowid,* FROM Transactions ORDER BY rowid DESC")
        Transactions = cur.fetchall()
    # transactionstext_format = ''
    for i, row in enumerate(Transactions, start=1):
        listbox.insert(END, f"{str(row[1])}  {row[2]} DUCO\n")

    listbox.config(highlightcolor=backgroundColor,
                   selectbackground="#f39c12",
                   bd=0,
                   yscrollcommand=scrollbar.set,
                   background=backgroundColor,
                   foreground=foregroundColor,
                   font=textFont)
    scrollbar.config(command=listbox.yview, background="#7bed9f")
Esempio n. 16
0
    def open_concurrent(self):
        """
        callback method for the open concurrent button, opens a new window with a new project identical in functionality to the original application
        """

        logging.info('Opening concurrent window')
        second_toolitems = (
            ('Home', 'Reset original view', 'home', 'home'),
            ('Back', 'Back to previous view', 'back', 'back'),
            ('Forward', 'Forward to next view', 'forward', 'forward'),
            (None, None, None, None),
            ('Pan', 'Pan axes with left mouse, zoom with right', 'move',
             'pan'),
            ('Zoom', 'Zoom to rectangle', 'zoom_to_rect', 'zoom'),
            ('Subplots', 'Configure subplots', 'subplots',
             'configure_subplots'),
            (None, None, None, None),
            ('Annotate', 'Create an annotation', 'annotate', 'call_annotate'),
            ('Confirm', 'Confirm annotation', 'confirm', 'call_confirm'),
            (None, None, None, None),
            ('Open', 'Opens a new project', 'open', 'call_open'),
            ('Export', 'Export to PDF', 'export', 'call_export'),
            ('Save', 'Save the graph as PNG', 'filesave', 'save_figure'),
            (None, None, None, None),
            ('Quit', 'Quit application', 'quit', 'call_quit'),
        )
        path = filedialog.askdirectory()
        path = path + "/"
        logging.info('Path given: {}'.format(path))
        try:
            logging.info('Checking validity of path')
            if data.check_valid_path(path):
                new_root = Toplevel(self.master)
                new_root.configure(bg='#949494')
                child_gui = TkBase(new_root, path, second_toolitems)
                child_gui.master.protocol("WM_DELETE_WINDOW",
                                          child_gui.child_close)
                child_gui.master.iconbitmap(r'res/general_images/favicon.ico')
            else:
                logging.warning('Invalid path given.')
        except Exception as e:
            logging.error(e)
            raise Exception(e)
class Scatter:
    def __init__(self, master, y_test, pred):
        self.master = master
        self.y_test = y_test
        self.pred = pred

        self.window = Toplevel(self.master)
        self.window.title("Scatter Plot (y_test vs predictions)")
        self.window.configure(background='white')
        self.window.resizable(False, False)

        self.figure = Figure(figsize=(5, 5), dpi=100)
        self.sub = self.figure.add_subplot(111)
        self.sub.scatter(self.y_test, self.pred, edgecolor='black')
        self.sub.plot()

        self.canvas = FigureCanvasTkAgg(self.figure, master=self.window)
        self.canvas.get_tk_widget().pack()
        self.canvas.draw()
Esempio n. 18
0
    def config(self):
        screen_config = Toplevel()
        screen_config.geometry("600x200")
        screen_config.resizable(0,0)
        screen_config.title("Configuración de puerto")
        screen_config.configure(background=self.colorFondo)

        # Etiquetas ---------------------------------------------------------------
        selec_velo = Label(screen_config, bg=self.colorWidgets, fg=self.colorLetra, text="selecciona la velocidad")
        selec_velo.place(x=20, y=20) 

        self.mosCom = Label(screen_config, bg=self.colorLetra)
        self.mosCom.configure(text="Mostrar Com")
        self.mosCom.place(x=20, y=20) 

        # lista de las velocidades ----------------------------------------------------------
        self.baudlist = ttk.Combobox(screen_config, value=self.baud_rate)
        self.baudlist.current(3)
        self.baudlist.place(x=150, y=20)

        # Listas de puertos
        self.Com = ttk.Combobox(screen_config, value=self.com_port)
        self.Com.current()
        self.Com.place(x=300, y=20)

        # botones-----------------------------------------------------------------------------
        self.aceptar = Button(screen_config, text="Aceptar",
                            bg=self.colorWidgets, fg=self.colorLetra,
                                command=self.print_baudrate(self.Com.get(), self.baudlist.get()))
        self.aceptar.place(x=500, y=20)

        # barra de progreso

        # self.progreso=ttk.Progressbar(screen_config,
        #                             length=100, mode="determinate")
        # self.progreso.place(x=10, y=50)

        # self.progreso.steep(5)

        #mostrarmas=

        screen_config.mainloop()
Esempio n. 19
0
    def get_by_text(self):
        top_txt = Toplevel()
        top_txt.resizable(False, False)
        top_txt.title("Pontos")
        top_txt.configure(background="azure2")

        #= Criação de widgets
        txt_entry = Text(top_txt)
        frm_btn = Frame(top_txt, bd=10, bg="azure2")
        btn_cancel = Button(frm_btn,
                            text="Cancelar",
                            command=top_txt.destroy,
                            bg="LightSkyBlue4",
                            width=5)

        #= Posicionamento de widgets
        txt_entry.pack()
        frm_btn.pack(side=BOTTOM)
        btn_cancel.pack(side=LEFT)

        #================================================================
        #= Função que valida o conteúdo da Text Entry e recebe os pontos
        #= (chamada ao clicar no botão)
        def get_pontos():
            self.txt_pontos = txt_entry.get("1.0", END)
            try:
                self.px, self.py, self.sx, self.sy = ler_excel(
                    self.txt_pontos)  #método ler_excel do módulo reader
                top_txt.destroy()
                self.proxJanelaGrafico()
            except ValueError:
                messagebox.showwarning("Erro!",
                                       "Valores inseridos incorretamente")

        #==============================

        #= Criação & posicionamento
        Button(frm_btn,
               text="OK",
               command=get_pontos,
               bg="LightSkyBlue4",
               width=5).pack(side=RIGHT)
Esempio n. 20
0
def sign_up():
    win = Toplevel()
    win.geometry('800x600')
    win.configure(background="#1D2745")
    Application_label = Label(win,
                              text="Agri-Mitron",
                              bg="#1D2745",
                              fg="white",
                              font=32)
    Application_label.place(x=375, y=150)
    name_label = Label(win, text="Name : ", bg="#1D2745", fg="white", font=32)
    name_label.place(x=250, y=200)
    name_entry = Entry(win)
    name_entry.place(x=350, y=200)
    email_id_label = Label(win,
                           text="Email ID : ",
                           bg="#1D2745",
                           fg="white",
                           font=32)
    email_id_label.place(x=250, y=250)
    email_id_entry = Entry(win)
    email_id_entry.place(x=350, y=250)
    password_label = Label(win,
                           text="Password : "******"#1D2745",
                           fg="white",
                           font=32)
    password_label.place(x=250, y=300)
    password_entry = Entry(win)
    password_entry.place(x=350, y=300)
    Sign_up_button = tkinter.Button(
        win,
        text="Sign Up",
        bg="#1D2745",
        fg="black",
        font=32,
        command=lambda: [
            email_dataset.append(email_id_entry.get()),
            password_dataset.append(password_entry.get()),
            exist(win)
        ])
    Sign_up_button.place(x=375, y=350)
Esempio n. 21
0
def opentext():
    new_wintext = Toplevel()
    new_wintext.geometry("720x720")
    new_wintext.title("good")
    lab1 = Label(new_wintext,
                 text="ENTER THE COMMAND : ",
                 bg="black",
                 font="Italic 36 bold",
                 padx=15,
                 pady=50,
                 fg="cyan")
    lab1.pack()
    ''' Label(new_wintext,text="1. CROP",bg="black",fg="cyan").grid(row=2)
    Label(new_wintext, text="2. ROTATE", bg="black", fg="cyan").grid(row=3)
    Label(new_wintext, text="3. BLUR", bg="black", fg="cyan").grid(row=4)
    Label(new_wintext, text="4. EDGES\n", bg="black", fg="cyan").grid(row=5)
    Entry(new_wintext,textvariable=command).grid(row=6)
    Label(new_wintext,text="", bg="black").grid(row=7)'''
    b4 = Button(new_wintext,
                fg="cyan",
                text="BLUR",
                bg="black",
                command=blurtext).pack()
    Label(new_wintext, text="", bg="black").pack()
    b6 = Button(new_wintext,
                fg="cyan",
                text="EDGES",
                bg="black",
                command=edgestext).pack()
    Label(new_wintext, text="", bg="black").pack()
    b5 = Button(new_wintext,
                fg="cyan",
                text="GREYSCALE",
                bg="black",
                command=greytext).pack()
    new_wintext.configure(background="black")
    Label(new_wintext, text="", bg="black").pack()
    b4 = Button(new_wintext, fg="cyan", text="EXIT", bg="black",
                command=exit1).pack()
    new_wintext.configure(background="black")
    new_wintext.mainloop()
    pass
Esempio n. 22
0
    def input_phone_number(self, event):
        new_window = Toplevel(self)
        new_window.geometry("300x400")
        new_window.configure(background='#00536a')

        self.controller.withdraw()

        def quit_phone_input():
            self.controller.show()
            new_window.destroy()

        def send_phone_input(event):
            self.controller.show()
            self.enter_phone_num['text'] = phone.get_complete_phone_number()
            new_window.destroy()

        new_window.bind("<<Phone Number Complete>>", send_phone_input)
        new_window.wm_protocol("WM_DELETE_WINDOW", quit_phone_input)

        phone = AddPhoneNumberInter(new_window, bg='#00536a')
Esempio n. 23
0
def viewClicked():
    viewFrame = Toplevel()
    viewFrame.geometry("800x500")
    viewFrame.configure(background="black")
    viewLab = tk.Label(viewFrame,
                       text="View Stock",
                       width=500,
                       height=5,
                       fg='yellow',
                       bg='black',
                       font=("Courier", 15))
    viewLab.pack()
    entry = tk.Entry(viewFrame, fg="white", bg='gray', width=50)
    entry.place(x=0, y=120)
    entry.insert(0, "Stock Symbol: ")
    submit = tk.Button(viewFrame,
                       height=1,
                       width=5,
                       text="Submit",
                       command=lambda: performProcessing(entry, viewFrame))
    submit.place(x=320, y=118)
class Coefficients:
    def __init__(self, master, intercept, coef, columns):
        self.master = master
        self.intercept = intercept
        self.coef = coef
        self.columns = columns

        self.window = Toplevel(self.master)
        self.window.title("Intercept and Coefficients")
        self.window.configure(background='white')
        self.window.resizable(False, False)

        self.intercept_label = Label(self.window,
                                     text='Intercept :',
                                     font=('Helvetica', 15, 'bold'),
                                     bg='antique white')
        self.intercept_label.grid(row=0, column=0, sticky=(N, S, E, W))
        self.intercept_value = Label(self.window,
                                     text=str(self.intercept),
                                     font=('Helvetica', 15),
                                     bg='white')
        self.intercept_value.grid(row=0, column=1, sticky=(N, S, E, W))

        self.coefs = Label(self.window,
                           text='Coefficients',
                           font=('Helvetica', 15, 'bold'),
                           bg='white')
        self.coefs.grid(row=1, column=0, columnspan=2, sticky=(N, S, E, W))

        for i in range(len(self.coef)):
            Label(self.window,
                  text=self.columns[i],
                  font=('Helvetica', 12),
                  bg='antique white').grid(row=i + 2,
                                           column=0,
                                           sticky=(N, S, E, W))
            Label(self.window,
                  text=str(self.coef[i]),
                  font=('Helvetica', 12),
                  bg='white').grid(row=i + 2, column=1, sticky=(N, S, E, W))
Esempio n. 25
0
def instructions(fontsize):
    new = Toplevel()
    nw = 850
    nh = 600
    nws = new.winfo_screenwidth()  # width of the screen
    nhs = new.winfo_screenheight()  # height of the screen
    nx = (nws / 2) - (nw / 2)
    ny = (nhs / 2) - (nh / 2)
    new.geometry('%dx%d+%d+%d' % (nw, nh, nx, ny))
    new.title('U-Pack Instructions')
    new.configure(bg=vtmaroon, pady=5, padx=5)
    new.grid_propagate(False)
    new.grid_rowconfigure(0, weight=1)
    new.grid_columnconfigure(0, weight=1)
    txt = Text(new, relief='sunken', bd=4, fg='black', bg=vtsmoke)
    txt.config(pady=10, padx=40, font=('Times', fontsize), wrap='word')
    txt.grid(column=0, row=0, sticky='nsew')
    scroller = Scrollbar(new, orient='vertical', command=txt.yview)
    scroller.grid(column=1, row=0, sticky='nsew')
    txt['yscrollcommand'] = scroller.set
    OKa = Button(new, command=new.destroy, text='OK')
    OKa.configure(bg=hokiestone,
                  bd=4,
                  fg='black',
                  font=('Arial', fontsize),
                  highlightbackground=vtmaroon,
                  relief='raised')
    OKa.grid(column=0, row=1, sticky='nsew')
    instructtext = resource_path("UPackInstructions.txt")
    if path.exists(instructtext):
        with open(instructtext) as inst:
            quote = inst.read()
            txt.insert('end', quote)
    else:
        pathstring = str(instructtext)
        messagebox.showwarning(message="Cannot find the file:\n\'%s\'." %
                               pathstring)
Esempio n. 26
0
 def newWindow(self, parent):
     random.seed()
     colorInt = random.randint(0,2)
     if colorInt == 0:
         bgColor = "red"
     elif colorInt == 1:
         bgColor = "white"
     else:
         bgColor = "blue"
     top = Toplevel()
     winWidth, winHeight = 200, 200
     top.minsize(width=winWidth, height=winHeight)
     top.title("New!")
     top.configure(background=bgColor)
     label = Label(top, text=("This window has a " + str(bgColor) +
                              " background!"))
     label.pack(side="top")
     but = Button(top, text="New Window",
                  command= lambda: self.newWindow(parent))
     but.pack(expand=True)
     but2 = Button(top, text="Close All", command=parent.destroy)
     but2.pack(side="bottom")
     but3 = Button(top, text="Close Current", command=top.destroy)
     but3.pack(side="bottom")
Esempio n. 27
0
def editClicked():
    editFrame = Toplevel()
    editFrame.geometry("1200x800")
    editFrame.configure(background="black")
    viewLab = tk.Label(editFrame,
                       text="Edit Stock",
                       width=500,
                       height=5,
                       fg='yellow',
                       bg='black',
                       font=("Courier", 17))
    viewLab.pack()
    currentStocks = logic.showCurrentStocks()
    currentStockLab = tk.Label(editFrame, text=currentStocks, fg='black')
    currentStockLab.place(x=0, y=100)
    entry = tk.Entry(editFrame, fg="white", bg='gray', width=50)
    entry.place(x=250, y=100)
    entry.insert(0, "Stock Symbol to Edit: ")
    submit = tk.Button(editFrame,
                       height=1,
                       width=5,
                       text="Submit",
                       command=lambda: processEdit(entry, editFrame))
    submit.place(x=575, y=95)
Esempio n. 28
0
def startPassGen():
    global root
    root = Toplevel()
    root.attributes('-topmost', True)
    root.title("  Password Generator")
    root.geometry("350x380")
    # root.resizable(0,0)
    root.configure(bg="white")
    root.iconphoto(True, PhotoImage(file=assetpath + 'padlock.png'))
    root.tk.call('tk', 'scaling', 1.6)

    style = Style()
    style.configure("TLabel", background="white")
    style.configure('TCheckbutton', background='white')

    mainf = Frame(root, bg="white")
    mainf.pack(pady=20, padx=20, ipadx=10, ipady=10)

    f1 = Frame(mainf, bg="white")
    f1.pack()
    icon = ImageTk.PhotoImage(
        Image.open(assetpath + 'key.png').resize((45, 45)))
    Label(f1, image=icon, bg="white").grid(row=0,
                                           column=0,
                                           rowspan=2,
                                           padx=2,
                                           pady=5)
    Label(f1, text="Pass-Gen", font=('ARIAL', 15, 'bold'),
          bg="white").grid(row=0, column=2)
    Label(f1, text="Password Generator", bg="white").grid(row=1, column=2)

    f2 = Frame(mainf, bg="white")
    f2.pack(padx=10, pady=(30, 15))
    global passe
    passe = Entry(f2, width=30)
    passe.pack(side=LEFT)
    copyi = ImageTk.PhotoImage(
        Image.open(assetpath + 'copy.png').resize((25, 25)))
    copyb = Button(f2,
                   image=copyi,
                   bg="white",
                   bd=0,
                   activebackground="white",
                   command=lambda: copy2clip(passe.get()))
    copyb.pack(side=LEFT, padx=2)

    global length
    length = 8

    lenf = Frame(mainf)
    lenf.pack()
    Label(lenf, text="Length  ", bg="white").pack(side=LEFT)
    s = Spinbox(lenf,
                from_=4,
                to=25,
                width=5,
                command=lambda: setlength(s.get()))
    s.set(8)
    s.pack(side=LEFT)

    upper = BooleanVar()
    digit = BooleanVar()
    special = BooleanVar()
    upper.set(True)
    digit.set(True)
    special.set(True)
    f3 = Frame(mainf, bg="white")
    f3.pack(padx=10, pady=10)
    capb = Checkbutton(f3,
                       text="Include Capitals",
                       variable=upper,
                       offvalue=False,
                       onvalue=True)
    capb.pack(anchor=W, pady=5)
    digitb = Checkbutton(f3,
                         text="Include Digits",
                         variable=digit,
                         offvalue=False,
                         onvalue=True)
    digitb.pack(anchor=W, pady=5)
    specialb = Checkbutton(f3,
                           text="Include Special Symbols",
                           variable=special,
                           offvalue=False,
                           onvalue=True)
    specialb.pack(anchor=W, pady=5)

    genb = Button(mainf,
                  text="Generate",
                  command=lambda: passGen(length, upper.get(), digit.get(),
                                          special.get()),
                  bg="turquoise3",
                  activebackground="turquoise3",
                  bd=0)
    genb.pack(pady=10, ipadx=20, padx=(43, 10), side=LEFT)
    exitb = Button(mainf,
                   text="Exit",
                   command=exitPassGen,
                   bg="firebrick1",
                   activebackground="firebrick1",
                   bd=0,
                   width=37)
    exitb.pack(pady=10, ipadx=20, padx=(10, 30), side=LEFT)

    root.mainloop()
Esempio n. 29
0
class TelaPontos():

    #==================================================================
    #= Métodos que envolvem a criação e posicionamento de widgets
    #= na janela
    #==================================================================
    def __init__(self, janela, jAnterior):
        self.janela = janela
        self.jAnterior = jAnterior

        # Essas são as listas onde ficarão todos os pontos que serão
        # passados para a classe de ajuste de curvas.
        self.px = []
        self.py = []
        self.sx = []
        self.sy = []

        self.opt = IntVar()

        # Criação de widgets
        self.texto = Label(self.janela,
                           text="Selecione o modo de entrada dos pontos.",
                           bg="azure2")

        self.btn_fit = Button(self.janela,
                              text="Ok",
                              command=self.radio_choice,
                              bg="LightSkyBlue4",
                              width=5)
        self.btn_cancel = Button(self.janela,
                                 text="Voltar",
                                 command=self.voltar,
                                 bg="LightSkyBlue4")

        self.radio_escolha_arquivo = Radiobutton(self.janela,
                                                 variable=self.opt,
                                                 value=1,
                                                 text="Arquivo",
                                                 bg="azure2",
                                                 width=14,
                                                 anchor="w")
        self.radio_escolha_texto = Radiobutton(self.janela,
                                               variable=self.opt,
                                               value=2,
                                               text="Copiar do excel",
                                               bg="azure2",
                                               width=14,
                                               anchor="w")
        self.radio_inserir_pontos = Radiobutton(self.janela,
                                                variable=self.opt,
                                                value=3,
                                                text="Valores",
                                                bg="azure2",
                                                width=14,
                                                anchor="w")
        self.radio_inserir_pontos.select()

        self.tip = Label(self.janela, text="?", bg="LightSkyBlue4", width=3)

        #== Posicionamento de widgets
        self.redesenhar()

        ToolTip(
            self.tip,
            "Valores: Insere um ponto de cada vez\nArquivo: Lê um arquivo csv.\nCopiar do excel: Lê os valores copiados das tabelas de um arquivo Excel\n\nObs: Todos em todas as opções de entrada os pontos devem ser colocados\nno formato: X, Y, Erro de X, Erro de Y."
        )
        '''
        self.frm_upper.pack()
        self.frm_down.pack(side=BOTTOM)
        self.frm_radio.pack(side=RIGHT)
        self.radio_inserir_pontos.grid(row=0, column=3)
        self.radio_escolha_arquivo.grid(row=1, column=3)
        self.radio_escolha_texto.grid(row=2, column=3)
        self.btn_fit.grid(row=4, column=4)
        self.btn_cancel.grid(row=4, column=0)
        '''

    #==================================================================
    #=Função para limpar a janela atual e chamar a janela dos gráficos.
    #=Os pontos lidos são passados para o construtor
    def proxJanelaGrafico(self):
        self.limparJanela()
        TelaGrafico(self.janela, self, self.px, self.sx, self.py, self.sy)

    #==================================================================
    def voltar(self):
        self.limparJanela()
        self.jAnterior.redesenhar()

    #==================================================================
    def redesenhar(self):
        # Posicionamento de widgets
        self.janela.geometry("325x300+400+200")
        self.texto.place(x=13, y=4)
        self.tip.place(x=287, y=4)

        tam = 90
        self.radio_inserir_pontos.place(x=tam, y=30)
        self.radio_escolha_arquivo.place(x=tam, y=52)
        self.radio_escolha_texto.place(x=tam, y=74)

        self.btn_fit.place(x=161, y=260)
        self.btn_cancel.place(x=91, y=260)

    #==================================================================
    def limparJanela(self):
        # Limpando os widgets
        self.texto.place_forget()
        self.tip.place_forget()
        self.btn_fit.place_forget()
        self.btn_cancel.place_forget()
        self.texto.place_forget()
        self.radio_escolha_arquivo.place_forget()
        self.radio_escolha_texto.place_forget()
        self.radio_inserir_pontos.place_forget()

    #==================================================================
    #==================================================================
    #==================================================================
    #=Janela da caixa de texto. Nela, existe uma caixa de texto para onde
    #=os pontos devem ser copiados no formato x - erro x - y - erro y
    def get_by_text(self):
        top_txt = Toplevel()
        top_txt.resizable(False, False)
        top_txt.title("Pontos")
        top_txt.configure(background="azure2")

        #= Criação de widgets
        txt_entry = Text(top_txt)
        frm_btn = Frame(top_txt, bd=10, bg="azure2")
        btn_cancel = Button(frm_btn,
                            text="Cancelar",
                            command=top_txt.destroy,
                            bg="LightSkyBlue4",
                            width=5)

        #= Posicionamento de widgets
        txt_entry.pack()
        frm_btn.pack(side=BOTTOM)
        btn_cancel.pack(side=LEFT)

        #================================================================
        #= Função que valida o conteúdo da Text Entry e recebe os pontos
        #= (chamada ao clicar no botão)
        def get_pontos():
            self.txt_pontos = txt_entry.get("1.0", END)
            try:
                self.px, self.py, self.sx, self.sy = ler_excel(
                    self.txt_pontos)  #método ler_excel do módulo reader
                top_txt.destroy()
                self.proxJanelaGrafico()
            except ValueError:
                messagebox.showwarning("Erro!",
                                       "Valores inseridos incorretamente")

        #==============================

        #= Criação & posicionamento
        Button(frm_btn,
               text="OK",
               command=get_pontos,
               bg="LightSkyBlue4",
               width=5).pack(side=RIGHT)

    #==================================================================
    # Função para criar um novo conjunto de entradas para os pontos e erros
    def append_labels(self, janela):

        self.labels.append(Label(janela, text="X", background="azure2"))
        self.labels[-1].grid(row=self.tam, column=0)
        self.labels.append(Label(janela, text="Y", background="azure2"))
        self.labels[-1].grid(row=self.tam, column=2)
        self.labels.append(Label(janela, text="Erro X", background="azure2"))
        self.labels[-1].grid(row=self.tam, column=4)
        self.labels.append(Label(janela, text="Erro Y", background="azure2"))
        self.labels[-1].grid(row=self.tam, column=6)
        #==================================================
        self.inserts.append(Entry(janela, width=10))
        self.inserts[-1].grid(row=self.tam, column=1)
        self.inserts.append(Entry(janela, width=10))
        self.inserts[-1].grid(row=self.tam, column=3)
        self.inserts.append(Entry(janela, width=10))
        self.inserts[-1].grid(row=self.tam, column=5)
        self.inserts.append(Entry(janela, width=10))
        self.inserts[-1].grid(row=self.tam, column=7)

        self.tam += 1

    #======================================================
    #= Função que itera pelas caixas de texto recebidas
    #= e passa todos os pontos e erros para as listas
    #= de pontos e erros
    def salvar_pontos(self):

        try:
            self.px, self.py, self.sx, self.sy = validar_pontos(self.inserts)
            self.proxJanelaGrafico()
            self.top_pontos.destroy()
        except ValueError:
            messagebox.showwarning("Erro!", "Valores inseridos incorretamente")

        #self.top_pontos.destroy()

    #======================================================
    #= Janela onde os pontos serão inseridos manualmente
    def janela_Inserir_Pontos(self):
        self.top_pontos = Toplevel(bd=10)
        self.top_pontos.resizable(False, False)
        self.top_pontos.title("Pontos")
        self.top_pontos.configure(background="azure2")

        self.tam = 0
        self.labels = []
        self.inserts = []

        #= Criação de widgets
        frame_pontos = Frame(self.top_pontos,
                             height=300,
                             width=500,
                             bd=10,
                             background="azure2")

        btn_add = Button(self.top_pontos,
                         text="Adicionar ponto",
                         bg="LightSkyBlue4")
        btn_cancel = Button(self.top_pontos,
                            text="Cancelar",
                            command=self.top_pontos.destroy,
                            bg="LightSkyBlue4",
                            width=5)
        btn_add["command"] = partial(self.append_labels, frame_pontos)
        btn_ok = Button(self.top_pontos,
                        text="Ok",
                        command=self.salvar_pontos,
                        bg="LightSkyBlue4",
                        width=5)

        #= Posicionamento de widgets
        frame_pontos.pack(side=BOTTOM)

        btn_add.pack(side=RIGHT)
        btn_ok.pack(side=LEFT)
        btn_cancel.pack(side=LEFT)

        #= Cria o primeiro conjunto de entradas
        self.append_labels(frame_pontos)

    #==================================================================
    #= Função que define qual método de inserção será chamado, depenendo
    #= do radio button selecionado
    def radio_choice(self):
        if (self.opt.get() == 1):
            self.get_File()
        elif (self.opt.get() == 2):
            self.get_by_text()
        elif (self.opt.get() == 3):
            self.janela_Inserir_Pontos()

    #==================================================================
    #= Função para o método através do arquivo csv. Abre uma caixa que
    #= solicita um arquivo e passa seu caminho para a função ler_csv
    #= do módulo reader.
    def get_File(self):
        filename = filedialog.askopenfilename(filetypes=[("arquivo csv",
                                                          "*.csv")])
        if filename:
            self.px, self.py, self.sx, self.sy = ler_csv(filename)
            self.proxJanelaGrafico()
Esempio n. 30
0
def doctors():
    global enter_city, doc

    doc = Toplevel()
    doc.geometry('600x300')
    doc.resizable(0, 0)
    doc.configure(background='AntiqueWhite1')
    doc.title('Doctors')

    menu = Menu(root)
    option = Menu(menu, tearoff=0)
    option.add_command(label='Info', command=info)
    option.add_separator()
    option.add_command(label="Exit", command=root.quit)
    menu.add_cascade(label="About", menu=option)

    help = Menu(menu, tearoff=0)
    help.add_command(label='Doctor info', command=doctors)
    menu.add_cascade(label="Help", menu=help)
    root.config(menu=menu)

    doc_menu = Menu(doc)
    doc_option = Menu(doc_menu, tearoff=0)
    doc_option.add_command(label='Info', command=info)
    doc_option.add_separator()
    doc_option.add_command(label="Exit", command=doc.destroy)
    doc_menu.add_cascade(label="About", menu=doc_option)

    doc_help = Menu(doc_menu, tearoff=0)
    doc_help.add_command(label='Doctor info', command=doctors)
    doc_menu.add_cascade(label="Help", menu=doc_help)
    doc.config(menu=doc_menu)

    doc_img = Image.open('doctor.jpg').convert('RGB')
    doc_img = doc_img.resize((int(150), int(150)), Image.ANTIALIAS)
    doc_img.save('doc.ppm', 'ppm')
    doc_img = PhotoImage(file='doc.ppm')

    details = Label(doc,
                    text='Download Details',
                    font=('bold', 15),
                    bg='AntiqueWhite1',
                    fg='black')
    details.place(x=230, y=20)

    label = Label(doc, image=doc_img)
    label.place(x=370, y=80)

    city = Label(doc, text='City', font=('bold', 13), bg='AntiqueWhite1')
    city.place(x=70, y=120)
    enter_city = Entry(doc, bg='white', fg='black')
    enter_city.place(x=120, y=122)

    dload = Button(doc,
                   text='Download',
                   font=('bold', 11),
                   bg='white',
                   fg='black',
                   activebackground='orange',
                   command=download)
    dload.place(x=85, y=150)

    doc.mainloop()
Esempio n. 31
0
class Interface:
    def __init__(self):
        log.info(f'{__name__} has been initialized.')

        self.window = Tk()
        self.window.title(f"FIB v{current_version}")
        self.window.geometry("380x225")
        self.style = Style()
        # if sys.platform == "win32":
        #     self.style.theme_use('winnative')
        self.window.minsize(380, 200)
        self.window.wait_visibility(self.window)
        self.windowWidth = self.window.winfo_reqwidth()
        self.windowHeight = self.window.winfo_reqheight()
        # Gets both half the screen width/height and window width/height
        self.positionRight = int(self.window.winfo_screenwidth() / 2 -
                                 self.windowWidth / 2)
        self.positionDown = int(self.window.winfo_screenheight() / 2 -
                                self.windowHeight / 2)
        self.window.geometry("+{}+{}".format(self.positionRight,
                                             self.positionDown))
        self.window.grid_columnconfigure(0, weight=1)
        self.window.resizable(0, 0)
        self.window.attributes("-topmost", True)

        self.window.protocol("WM_DELETE_WINDOW", self.on_closing)

        self.main_menu = Menu(self.window)

        self.file_menu = Menu(self.main_menu, tearoff=0)
        # self.file_menu.add_command(label="Save")
        self.file_menu.add_command(label="Exit", command=self.menu_exit)

        self.help_menu = Menu(self.main_menu, tearoff=0)
        self.help_menu.add_command(label="About", command=self.menu_about)
        self.help_menu.add_command(label="Change License Key",
                                   command=self.menu_change_license)

        self.main_menu.add_cascade(label="File", menu=self.file_menu)
        self.main_menu.add_cascade(label="Help", menu=self.help_menu)

        self.window.config(menu=self.main_menu)

        self.info_label = Label(self.window,
                                text="STOP BOT: SHIFT + ESC",
                                font=("Helvetica", 16))
        self.info_label.grid(column=0, row=0, padx=15, pady=10, columnspan=2)

        self.btn1 = Button(self.window,
                           text="GENERAL OPTIONS",
                           command=self.options_win,
                           width=50)
        self.btn1.grid(column=0, row=1, padx=15, pady=5, columnspan=2)

        self.btn2 = Button(self.window,
                           text="CONFIGURE PARTY",
                           command=self.party_win,
                           width=50)
        self.btn2.grid(column=0, row=2, padx=15, pady=0, columnspan=2)

        self.gobtn = Button(self.window,
                            text="<---    START    --->",
                            command=self.ready_set_go,
                            width=50)
        self.gobtn.config(foreground="white", background="blue")
        self.gobtn.grid(column=0, row=3, padx=15, pady=20, columnspan=2)

        # self.window.bind('<Control-n>', self.party_win)

        # self.window.after(300, self.status_win)

        self.window.mainloop()

    def ready_set_go(self):
        self.window.quit()
        self.window.withdraw()
        self.window.destroy()
        database.paused = False
        log.info(f"FIB v{current_version} was started!")

    def options_win(self, e=None):
        self.window.withdraw()
        self.options_win = Toplevel(self.window)
        self.options_win.protocol("WM_DELETE_WINDOW", self.options_on_close)
        self.options_win.title(f"FIB v{current_version}")
        # self.options_win.geometry("400x315")
        self.options_win.minsize(width=400, height=315)
        self.options_win.maxsize(width=400, height=315)
        self.options_win.grid_columnconfigure(0, weight=1)
        self.options_win.grid_columnconfigure(2, weight=1)
        self.options_win.resizable(width=False, height=False)
        # self.options_win.pack_propagate(0)
        self.options_win.attributes("-topmost", True)
        self.options_win.geometry("+{}+{}".format(self.positionRight,
                                                  self.positionDown))

        self.options_text = Label(
            self.options_win,
            text="Use the boxes below to set your preferred options.")
        self.options_text.grid(column=0, row=0, padx=15, pady=5, columnspan=2)

        # Toggle if you want the bot to automatically prestige for you

        self.prestige_state = BooleanVar(self.options_win)
        if database.auto_prestige:
            self.prestige_state.set(True)
        self.prestige_toggle = Checkbutton(self.options_win,
                                           text="Auto-Prestige?",
                                           var=self.prestige_state)
        self.prestige_toggle.grid(column=0, row=5, padx=15, pady=5, sticky="w")

        # Selection for update channel

        self.updates_label = Label(self.options_win, text="Updates Channel:")
        self.updates_label.grid(column=0, row=3, padx=15, pady=2, sticky="w")

        self.channel_choice = Combobox(self.options_win, state="readonly")
        self.channel_choice['values'] = ("Stable", "Development")
        if database.channel == "Stable":
            self.channel_choice.current(0)
        elif database.channel == "Development":
            self.channel_choice.current(1)
        else:
            self.channel_choice['values'] = self.channel_choice['values'] + (
                database.channel, )
            self.channel_choice.current(2)
        self.channel_choice.grid(column=0, row=4, padx=15, pady=5, sticky="w")

        self.guardian_label = Label(self.options_win, text="Which Guardian:")
        self.guardian_label.grid(column=0, row=1, padx=15, pady=2, sticky="w")

        self.guardian_choice = Combobox(self.options_win, state="readonly")
        self.guardian_choice['values'] = [x for x in database.guardians]
        if database.guardian == "Fairy":
            self.guardian_choice.current(1)
        elif database.guardian == "Dragon":
            self.guardian_choice.current(0)
        self.guardian_choice.grid(column=0, row=2, padx=15, pady=5, sticky="w")

        self.guild_missions_state = BooleanVar(self.options_win)
        if database.guild_missions:
            self.guild_missions_state.set(True)
        self.guild_missions_toggle = Checkbutton(self.options_win,
                                                 text="Guild Missions?",
                                                 var=self.guild_missions_state)
        self.guild_missions_toggle.grid(column=1,
                                        row=5,
                                        padx=15,
                                        pady=5,
                                        sticky="w")

        self.prestige_level_label = Label(self.options_win,
                                          text="Prestige Multiplier:")
        self.prestige_level_label.grid(column=1,
                                       row=1,
                                       padx=15,
                                       pady=2,
                                       sticky="w")

        self.prestige_level = Entry(self.options_win)
        self.prestige_level.grid(column=1, row=2, padx=15, pady=5, sticky="w")
        self.prestige_level.insert(0, database.prestige_level)

        self.g_btn = Button(self.options_win,
                            text="SAVE",
                            width=40,
                            command=self.options_save)
        self.g_btn.grid(column=0, row=6, padx=15, pady=15, columnspan=2)
        self.g_btn.config(foreground="white", background="blue")

    def options_save(self, e=None):
        database.save_option('prestige_level', self.prestige_level.get())
        # config['OPTIONS']['in_guild'] = str(self.guild_state.get())
        database.save_option('auto_prestige', self.prestige_state.get())
        database.save_option('guild_missions', self.guild_missions_state.get())
        database.save_option('guardian', self.guardian_choice.get())

        self.window.deiconify()
        self.options_win.destroy()

    def party_win(self, e=None):
        self.window.withdraw()
        self.party_win = Toplevel(self.window)
        self.party_win.protocol("WM_DELETE_WINDOW", self.party_on_close)
        self.party_win.title(f"FIB v{current_version}")
        # self.party_win.geometry("350x275")
        self.party_win.minsize(width=400, height=350)
        self.party_win.maxsize(width=400, height=350)
        self.party_win.resizable(width=False, height=False)
        self.party_win.grid_columnconfigure(0, weight=1)
        self.party_win.grid_columnconfigure(2, weight=1)
        self.party_win.attributes("-topmost", True)
        self.party_win.geometry("+{}+{}".format(self.positionRight,
                                                self.positionDown))
        """

        Begin building the GUI

        """
        self.party_text = Label(
            self.party_win,
            text="Use the boxes below to set your party options.")
        self.party_text.grid(column=0, row=0, padx=15, pady=5, columnspan=2)

        self.party1_label = Label(self.party_win, text="Party Slot 01:")
        self.party1_label.grid(column=0, row=1, padx=15, pady=5, sticky="w")

        self.party2_label = Label(self.party_win, text="Party Slot 02:")
        self.party2_label.grid(column=1, row=1, padx=15, pady=5, sticky="w")

        self.party1 = Combobox(self.party_win, state="readonly")
        self.party1['values'] = [x for x in database.heroes]
        self.party1.current(4)
        self.party1.grid(column=0, row=2, padx=15, pady=5, sticky="w")

        self.party2 = Combobox(self.party_win, state="readonly")
        self.party2['values'] = [x for x in database.heroes]
        self.party2.current(10)
        self.party2.grid(column=1, row=2, padx=15, pady=5, sticky="w")

        self.party3_label = Label(self.party_win, text="Party Slot 03:")
        self.party3_label.grid(column=0, row=3, padx=15, pady=5, sticky="w")

        self.party4_label = Label(self.party_win, text="Party Slot 04:")
        self.party4_label.grid(column=1, row=3, padx=15, pady=5, sticky="w")

        self.party3 = Combobox(self.party_win, state="readonly")
        self.party3['values'] = [x for x in database.heroes]
        self.party3.current(5)
        self.party3.grid(column=0, row=4, padx=15, pady=5, sticky="w")

        self.party4 = Combobox(self.party_win, state="readonly")
        self.party4['values'] = [x for x in database.heroes]
        self.party4.current(2)
        self.party4.grid(column=1, row=4, padx=15, pady=5, sticky="w")

        self.party5_label = Label(self.party_win, text="Party Slot 05:")
        self.party5_label.grid(column=0, row=5, padx=15, pady=5, sticky="w")

        self.party_size_label = Label(self.party_win, text="Party Size:")
        self.party_size_label.grid(column=1,
                                   row=5,
                                   padx=15,
                                   pady=5,
                                   sticky="w")

        self.party5 = Combobox(self.party_win, state="readonly")
        self.party5['values'] = [x for x in database.heroes]
        self.party5.current(3)
        self.party5.grid(column=0, row=6, padx=15, pady=5, sticky="w")

        self.party_size = Combobox(self.party_win, state="readonly")
        self.party_size['values'] = ("1", "2", "3", "4", "5")
        self.party_size.current(4)
        self.party_size.grid(column=1, row=6, padx=15, pady=5, sticky="w")

        self.btn = Button(self.party_win,
                          text="SAVE",
                          command=self.party_save,
                          width=40)
        self.btn.grid(column=0, row=7, padx=15, pady=15, columnspan=2)
        self.btn.config(foreground="white", background="blue")

    def party_save(self):
        heroes = database.heroes.copy()
        selections = []
        selections.extend([
            self.party2.get(),
            self.party3.get(),
            self.party4.get(),
            self.party5.get()
        ])
        print(selections)

        party_slot_1 = self.party1.get()
        if party_slot_1 in heroes and party_slot_1 not in selections:
            database.save_option('party_slot_1', party_slot_1)
            heroes.remove(party_slot_1)
        else:
            messagebox.showerror(
                title="ERROR",
                message="PARTY SLOT 1: Invalid selection choice.")

        selections = []
        selections.extend([
            self.party1.get(),
            self.party3.get(),
            self.party4.get(),
            self.party5.get()
        ])
        print(selections)

        party_slot_2 = self.party2.get()
        if party_slot_2 in heroes and party_slot_2 not in selections:
            database.save_option('party_slot_2', party_slot_2)
            heroes.remove(party_slot_2)
        else:
            messagebox.showerror(
                title="ERROR",
                message="PARTY SLOT 2: Invalid selection choice.")

        selections = []
        selections.extend([
            self.party1.get(),
            self.party2.get(),
            self.party4.get(),
            self.party5.get()
        ])
        print(selections)

        party_slot_3 = self.party3.get()
        if party_slot_3 in heroes and party_slot_3 not in selections:
            database.save_option('party_slot_3', party_slot_3)
            heroes.remove(party_slot_3)
        else:
            messagebox.showerror(
                title="ERROR",
                message="PARTY SLOT 3: Invalid selection choice.")

        selections = []
        selections.extend([
            self.party1.get(),
            self.party2.get(),
            self.party3.get(),
            self.party5.get()
        ])
        print(selections)

        party_slot_4 = self.party4.get()
        if party_slot_4 in heroes and party_slot_4 not in selections:
            database.save_option('party_slot_4', party_slot_4)
            heroes.remove(party_slot_4)
        else:
            messagebox.showerror(
                title="ERROR",
                message="PARTY SLOT 4: Invalid selection choice.")

        selections = []
        selections.extend([
            self.party1.get(),
            self.party2.get(),
            self.party3.get(),
            self.party4.get()
        ])
        print(selections)

        party_slot_5 = self.party5.get()
        if party_slot_5 in heroes and party_slot_5 not in selections:
            database.save_option('party_slot_5', party_slot_5)
            heroes.remove(party_slot_5)
        else:
            messagebox.showerror(
                title="ERROR",
                message="PARTY SLOT 5: Invalid selection choice.")

        database.save_option('party_size', self.party_size.get())

        self.window.deiconify()
        self.party_win.destroy()

    def status_win(self, e=None):
        # self.window.withdraw()
        print('Deploy status window')
        self.status_win = Toplevel(self.window)
        self.status_win.configure(background="black")
        self.status_win.overrideredirect(1)
        self.status_win.protocol("WM_DELETE_WINDOW", self.status_on_close)
        self.status_win.title(f"Idle Bot Status")
        self.status_win.geometry("350x35")
        self.status_win.grid_columnconfigure(0, weight=1)
        self.status_win.grid_columnconfigure(0, weight=2)
        self.status_win.resizable(0, 0)
        # self.status_win.pack_propagate(0)
        self.status_win.attributes("-topmost", True)
        self.status_win.geometry("+{}+{}".format(0, 0))

        self.status_text = Label(
            self.status_win,
            foreground="white",
            background="black",
            text="IDLE BOT: Verify my settings before we get started.")
        self.status_text.grid(column=0,
                              row=0,
                              padx=5,
                              pady=5,
                              columnspan=2,
                              sticky="w")

    def update_status(self, status):
        self.status_text.config(text=f"IDLE BOT: {status}")
        self.status_win.update()

    def menu_exit(self):
        self.window.quit()
        self.window.destroy()
        database.running = False

    def menu_change_license(self):
        self.change_license()

    def menu_about(self):
        if database.email:
            user = database.email
        else:
            user = "******"

        messagebox.showinfo(
            f"ABOUT",
            f"FIRESTONE IDLE BOT v{current_version}\n\nLICENSED TO: {user}\n{database.edition}\n\nThank you for supporting Firestone Idle Bot!",
            parent=self.window)

    def options_on_close(self):
        self.window.deiconify()
        self.options_win.destroy()

    def status_on_close(self):
        self.status_win.destroy()

    def party_on_close(self):
        self.window.deiconify()
        self.party_win.destroy()

    def on_closing(self):
        self.window.quit()
        self.window.destroy()
        database.running = False
Esempio n. 32
0
class OptionsDialog():
    def __init__(self,
                 parent,
                 master=None,
                 title="",
                 prompt="",
                 opts=None,
                 radio=True,
                 yesno=True,
                 list=False):
        if not opts:
            opts = []
        self.win = Toplevel(parent)
        self.win.protocol("WM_DELETE_WINDOW", self.quit)
        if parent:
            self.win.geometry(
                "+%d+%d" %
                (parent.winfo_rootx() + 50, parent.winfo_rooty() + 50))
        self.parent = parent
        self.master = master
        self.options = opts
        self.radio = radio
        self.win.title(title)
        if list:
            self.win.configure(bg=BGCOLOR)
            tkfixedfont = tkFont.nametofont("TkFixedFont")
            if 'fontsize_fixed' in self.parent.options and self.parent.options[
                    'fontsize_fixed']:
                tkfixedfont.configure(
                    size=self.parent.options['fontsize_fixed'])
            self.content = ReadOnlyText(self.win,
                                        wrap="word",
                                        padx=3,
                                        bd=2,
                                        height=10,
                                        relief="sunken",
                                        font=tkfixedfont,
                                        bg=BGLCOLOR,
                                        highlightbackground=BGLCOLOR,
                                        width=46,
                                        takefocus=False)
            self.content.pack(fill=tkinter.BOTH, expand=1, padx=10, pady=5)
            self.content.insert("1.0", prompt)
        else:
            Label(self.win, text=prompt,
                  justify='left').pack(fill=tkinter.BOTH,
                                       expand=1,
                                       padx=10,
                                       pady=5)
            self.sv = StringVar(parent)
        self.sv = IntVar(parent)
        self.sv.set(1)
        if self.options:
            if radio:
                self.value = opts[0]
                for i in range(min(9, len(self.options))):
                    txt = self.options[i]
                    val = i + 1
                    # bind keyboard numbers 1-9 (at most) to options selection, i.e., press 1 to select option 1, 2 to select 2, etc.
                    self.win.bind(str(val), (lambda e, x=val: self.sv.set(x)))
                    Radiobutton(self.win,
                                text="{0}: {1}".format(val, txt),
                                padx=20,
                                indicatoron=True,
                                variable=self.sv,
                                command=self.getValue,
                                value=val).pack(padx=10, anchor=W)
            else:
                self.check_values = {}
                # show 0, check 1, return 2
                for i in range(min(9, len(self.options))):
                    txt = self.options[i][0]
                    self.check_values[i] = BooleanVar(self.parent)
                    self.check_values[i].set(self.options[i][1])
                    Checkbutton(self.win,
                                text=self.options[i][0],
                                padx=20,
                                variable=self.check_values[i]).pack(padx=10,
                                                                    anchor=W)
        box = Frame(self.win)
        if list:
            box.configure(bg=BGCOLOR)
        if yesno:
            YES = _("Yes")
            NO = _("No")
        else:
            YES = _("Ok")
            NO = _("Cancel")
        c = Button(box, text=NO, width=10, command=self.cancel, pady=2)
        c.pack(side=LEFT, padx=5, pady=5)
        o = Button(box,
                   text=YES,
                   width=10,
                   default='active',
                   command=self.ok,
                   pady=2)
        o.pack(side=LEFT, padx=5, pady=5)
        if list:
            for b in [c, o]:
                b.configure(bg=BGCOLOR, highlightbackground=BGCOLOR)
        box.pack()
        self.win.bind('<Return>', (lambda e, o=o: o.invoke()))
        self.win.bind('<Control-w>', self.Ok)
        self.win.bind('<Escape>', (lambda e, c=c: c.invoke()))
        # self.choice.focus_set()
        logger.debug('parent: {0}'.format(parent))
        self.win.focus_set()
        self.win.transient(parent)
        self.win.wait_window(self.win)

    def getValue(self, e=None):
        v = self.sv.get()
        logger.debug("sv: {0}".format(v))
        if self.options:
            if self.radio:
                if v - 1 in range(len(self.options)):
                    o = self.options[v - 1]
                    logger.debug('OptionsDialog returning {0}: {1}'.format(
                        v, o))
                    return v, o
                    # return o, v
                else:
                    logger.debug('OptionsDialog returning {0}: {1}'.format(
                        v, None))
                    return 0, None
            else:  # checkbutton
                values = []
                for i in range(len(self.options)):
                    bool = self.check_values[i].get() > 0
                    values.append(
                        [self.options[i][0], bool, self.options[i][2]])
                return values
        else:  # askokcancel type dialog
            logger.debug('OptionsDialog returning {0}: {1}'.format(v, None))
            return v, v

    def ok(self, event=None):
        # self.parent.update_idletasks()
        self.quit()

    def Ok(self, event=None):
        # self.parent.update_idletasks()
        self.sv.set(2)
        self.quit()

    def cancel(self, event=None):
        self.sv.set(0)
        self.quit()

    def quit(self, event=None):
        # put focus back to the parent window
        if self.master:
            self.master.focus_set()
        elif self.parent:
            self.parent.focus_set()
        self.win.destroy()
Esempio n. 33
0
            lab_file["text"] = lab_file.cget("text") + name_file.split("/")[-1]


#Creating the main window and its configuration
main_win = Tk()
main_win.title("Projet_Algo")
main_win.geometry()
main_win.resizable(width=False, height=False)
color = "#9ccbd8"
main_win.configure(bg=color)
main_win.protocol("WM_DELETE_WINDOW", destroy)

#Creation and element of the "no step" window
win_no_step = Toplevel(main_win)
win_no_step.title("No Step")
win_no_step.configure(bg=color)
win_no_step.withdraw()
seq_no_step = Label(win_no_step)
seq_no_step2 = Label(win_no_step)
button_no_step = Button(win_no_step, text="Save")
win_no_step.protocol("WM_DELETE_WINDOW", red_cross_win_no_step)

#Creation and element of the window "with step".
font = font.Font(size=14, weight="bold")
win_step = Toplevel(main_win)
win_step.title("With step")
win_step.configure(bg=color)
win_step.withdraw()
text_step = Text(win_step)
text_step2 = Text(win_step)
text_sort = Text(win_step)