Example #1
0
 def __init__(self, root, parent, lang):
     """
     Primero se busca si existe la carpta de datos (bin) de no ser asi se crea.
     Segundo de busca si existe el archivo index.bin en la carpeta de datos, de no ser asi se crea.
     Al final se lee el archivo index y se establece el atributo current_index con el valor del
     archivo index.
     atributos:
     self.gui = parent es el parent del gui principal
     self.index es la bandera que marca si existe o no un index. Por defecto se inicia en False
     self.root_dir es el directorio actual donde se ejjecuta el projecto
     self.dirs es el nombre de la carpeta de datos
     self.dir_models es la ruta absoluta de la carpeta de datos
     """
     self.root = root
     self.gui = parent
     self.i18n = I18N(lang)
     self.index = False
     self.current_index = []
     self.root_dir = os.path.dirname(os.path.abspath(__file__))
     self.dirs = 'bin'
     self.search_or_make_dir('', self.dirs)
     self.dir_models = os.path.join(self.root_dir, self.dirs)
     self.search_index()
     self.load_index()
     self.pcbi = Image("photo", file="Resources/pinguinoChefPanbien.png")
     self.pcqi = Image("photo", file="Resources/pinguinoChefPanQuemado.png")
     self.lpzi = Image("photo", file="Resources/lapiz.png")
     self.ojoi = Image("photo", file="Resources/ojo.png")
Example #2
0
    def __init__(self, root, language='es'):
        self.lang = language
        self.root = root
        tk.Frame.__init__(self, self.root)
        # Se llama al canvas
        self.create_frame_canvas()
        # Se crea i18n para internacionalizacion
        self.i18n = I18N(self.lang)
        # Se crea instancia del modelo
        # Se inicializan imagenes del GUI

        self.pnv = Image("photo", file="Resources/PinguinoNoVe.png")
        self.pc = Image("photo", file="Resources/pinguinoChef.png")

        self.img = Image("photo", file="Resources/panque.png")

        self.mas = Image("photo", file="Resources/mas.png")
        # Se establece propidades de root
        self.root.title(self.i18n.title)
        self.root.resizable(1, 1)
        self.root.geometry("1200x700")
        self.root.tk.call('wm', 'iconphoto', self.root._w, self.img)
        # se llama al modulo callbacks
        self.call_backs = Callbacks(self)
        # Se llama a los widgets
        self.create_tabs()
        self.create_menubar()
        self.create_tab1()
        self.create_tab3()
        self.create_logo()
        self.total.set("300")
        self.tab_control.select(2)
Example #3
0
    def setButtons(self):
        self.dpl_img = Image("photo", file="img/deploy.png")
        self.dpl_bt = ttk.Button(self.root,
                                 text="Simulate deployment",
                                 style="nextPrev.TLabel",
                                 image=self.dpl_img,
                                 compound="bottom",
                                 command=self.deployPopup)
        self.dpl_bt.grid(row=0, column=0, columnspan=5, sticky="NESW")
        self.tdoa_img = Image("photo", file="img/TDOA.png")
        self.loc_bt = ttk.Button(self.root,
                                 text="Simulate localization",
                                 style="nextPrev.TLabel",
                                 image=self.tdoa_img,
                                 compound="bottom",
                                 command=self.notAvailable)
        self.loc_bt.grid(row=1, column=0, columnspan=5, sticky="NESW")
        self.dpl = Dpl()

        self.prev_day = ttk.Button(self.root,
                                   text="|◀◀",
                                   style="nextPrev.TLabel",
                                   command=self.previousDay)
        self.prev_day.grid(row=2, column=0, sticky="NESW")
        self.prev_min = ttk.Button(self.root,
                                   text="|◀",
                                   style="nextPrev.TLabel",
                                   command=self.previousMinute)
        self.prev_min.grid(row=2, column=1, sticky="NESW")
        self.play = ttk.Button(self.root,
                               text="▶️",
                               style="play.TLabel",
                               command=self.currentMinute)
        self.play.grid(row=2, column=2, sticky="NESW")
        self.next_min = ttk.Button(self.root,
                                   text="▶️|",
                                   style="nextPrev.TLabel",
                                   command=self.nextMinute)
        self.next_min.grid(row=2, column=3, sticky="NESW")
        self.next_day = ttk.Button(self.root,
                                   text="▶️▶️|",
                                   style="nextPrev.TLabel",
                                   command=self.nextDay)
        self.next_day.grid(row=2, column=4, sticky="NESW")
        self.dt_box = Entry(self.root)
        self.dt_box.configure({"background": self.bg})
        self.dt_box.configure({"foreground": self.fg})
        self.dt_box.grid(row=3, column=0, columnspan=5)
        self.format_dt()
Example #4
0
 def __init__(self, Sats):
     self.Sats = Sats
     self.sortSats()
     client = MongoClient("localhost", 27017)
     self.db = client["SatConstellation"]
     self.en_db = False
     self.root = Tk()
     self.img = Image("photo", file="img/favicon.png")
     self.root.call('wm', 'iconphoto', self.root._w, self.img)
     self.geometry()
     self.root.title('Pypredict')
     self.setTheme('#404040', 'white', '#303030')
     self.root.protocol("WM_DELETE_WINDOW", quit)
     self.saa = SAA()
     self.updtCnt = 0
     self.dmin = 0
     self.setButtons()
     self.world_map = Map("img/earth_nasa_day.png",
                          "img/earth_nasa_night.png")
     self.plotData()
     self.setCanvas()
     self.setMenu()
     self.data_gen()
     self.changeMainSat(self.Sats[0])
     self.cov_lng = empty(180)
     self.cov_lat = empty(180)
     self.setTableTitles()
     self.setTableContent()
     self.tableRefresher()
     self.setRootBindings()
     self.run()
Example #5
0
 def __init__(self, root, ver):
     self.root = root
     # resize
     self.root.rowconfigure(1, weight=1)
     self.root.columnconfigure(0, weight=1)
     self.root.columnconfigure(1, weight=1)
     self.fo = FileOperation()
     # widgets
     self.panel = (FileList(self, self.fo, 0), FileList(self, self.fo, 1))
     self.bar = Frame(self.root)
     self.bar.grid(row=0, column=0, sticky='we')
     self.menuFile()
     self.menuTag()
     self.menuHelp()
     self.panel[0].grid(row=1, column=0, sticky='nswe')
     self.panel[1].grid(row=1, column=1, sticky='nswe')
     # bind events
     self.root.bind('<F5>', self.copy)
     self.root.bind('<F6>', self.move)
     self.root.bind('<F1>', lambda x: msg.showinfo("Keys", KEYS))
     self.root.bind('<F9>',
                    lambda x: self.fo.execute(self.fo.getRandomFile()))
     self.root.bind('/', self.openSearch)
     self.root.bind('<Control-q>', lambda x: self.root.destroy())
     self.root.bind('=', self.makeEqual)
     # icon, title
     img = Image("photo", file="./manager/img/tm.gif")
     self.root.call('wm', 'iconphoto', self.root._w, img)
     self.root.title('TagManager v.' + ver)
     # evaluate
     self.root.mainloop()
Example #6
0
    def __init__(self):
        Tk.__init__(self)
        try:
            self.img = Image(
                "photo",
                file=join(dirname(import_module('lucterios.install').__file__),
                          "lucterios.png"))
            self.tk.call('wm', 'iconphoto', self._w, self.img)
        except Exception:
            self.img = None
        self.start_up_app()
        self.has_checked = False
        self.title(ugettext_lazy("Lucterios launcher"))
        self.minsize(475, 260)
        self.grid_columnconfigure(0, weight=1)
        self.grid_rowconfigure(0, weight=1)
        self.running_instance = {}
        self.resizable(True, True)
        self.protocol("WM_DELETE_WINDOW", self.on_closing)

        self.ntbk = ttk.Notebook(self)
        self.ntbk.grid(row=0, column=0, columnspan=1, sticky=(N, S, E, W))

        self.create_instance_panel()
        self.create_module_panel()

        stl = ttk.Style()
        stl.theme_use("default")
        stl.configure("TProgressbar", thickness=5)
        self.progress = ttk.Progressbar(self,
                                        style="TProgressbar",
                                        orient='horizontal',
                                        mode='indeterminate')
        self.progress.grid(row=1, column=0, sticky=(E, W))

        self.btnframe = Frame(self, bd=1)
        self.btnframe.grid(row=2, column=0, columnspan=1)
        Button(self.btnframe,
               text=ugettext_lazy("Refresh"),
               width=20,
               command=self.refresh).grid(row=0,
                                          column=0,
                                          padx=3,
                                          pady=3,
                                          sticky=(N, S))
        self.btnupgrade = Button(self.btnframe,
                                 text=ugettext_lazy("Search upgrade"),
                                 width=20,
                                 command=self.upgrade)
        self.btnupgrade.config(state=DISABLED)
        self.btnupgrade.grid(row=0, column=1, padx=3, pady=3, sticky=(N, S))
        Button(self.btnframe,
               text=ugettext_lazy("Close"),
               width=20,
               command=self.on_closing).grid(row=0,
                                             column=2,
                                             padx=3,
                                             pady=3,
                                             sticky=(N, S))
Example #7
0
 def create_tab2_test(self):
     """Crea el form de la tab2"""
     img1 = Image("photo", file="./Resources/pinguinoChef.png")
     lbl = ttk.Label(self.tab2, image=img1)
     lbl.image = img1
     lbl.grid(column=0, row=0, sticky='W')
     btn = ttk.Button(self.tab2, image=img1)
     btn.image = img1
     btn.grid(column=0, row=1)
Example #8
0
def create_window():
    window = turtle.Screen()
    window.title('WhatsApp Statistics')
    favicon = Image("photo", file=(PATH + 'images/favicon.png'))
    turtle._Screen._root.iconphoto(True, favicon)
    window.bgcolor('#040604')
    window.setup(width= 1.0, height= 1.0, startx=0, starty=0)
    window.tracer(0)
    window.addshape(PATH + 'images/logo.gif')
    window.addshape(PATH + 'images/button.gif')
    return window
Example #9
0
def Soumettre(pMotChoisit, pMotEnCours) :
    global nbrTentatives
    nbrTentatives = 0
    for i in range(len(pMotChoisit)) :
        if pMotChoisit[i] == Reponse.get() :
            pMotEnCours = pMotEnCours.split()[0:len(pMotChoisit)]
            pMotEnCours[i] = Reponse.get()
            pMotEnCours = ' '.join(pMotEnCours)
        else :
            nbrTentatives += 1
            nbrTentatives = Image(nbrTentatives)
    return pMotEnCours, nbrTentatives
Example #10
0
 def configurar_root(self):
     if sys.platform.startswith('win'):
         self.root.iconbitmap(
             'medidor_acustico/resources/icons/mic_icon.ico')
     else:
         mic = Image('photo',
                     file='medidor_acustico/resources/icons/mic_icon.png')
         self.root.tk.call('wm', 'iconphoto', self.root._w, mic)
     self.root.tk_setPalette(background='#831212')
     self.root.resizable(False, False)
     self.root.protocol('WM_DELETE_WINDOW',
                        self.controller.on_cerrar_ventana)
Example #11
0
 def form_details(self, name):
     produc = self.model.read_product(name)
     self.form_new_product()
     self.name.set(produc['name'])
     self.detail.set(produc['description'])
     self.cost.set(produc['cost'])
     self.tam.set(produc['size'])
     self.stock.set(produc['stock'])
     self.btn_save.configure(state='disabled')
     self.btn_save.grid_forget()
     self.btn_close = ttk.Button(self.topl,
                                 text=self.i18n.close,
                                 command=lambda: self.topl.destroy())
     lblimg = Image('photo',
                    file='/home/jintan/PycharmProjects/El_Panque/pin.png')
     lbl_img = ttk.Label(self.topl, image=lblimg)
     lbl_img.image = lblimg
     lbl_img.grid(column=2, row=0, rowspan=7)
     self.btn_close.grid(column=2, row=7, sticky=tk.SE)
Example #12
0
 def __init__(self, *args, **kwargs):
     Tk.__init__(self, *args, **kwargs)
     self.geometry("{}x{}".format(self.winfo_screenwidth(),
                                         self.winfo_screenheight()))
     self.title("JBM - Jojo Bark Messenger")
     self.option_add("*Font", "Times 10")
     try:
         try:
             self.tk.call("tk_getOpenFile", "-foobarbaz")
         except TclError:
             pass
         self.tk.call("set", "::tk::dialog::file::showHiddenVar", "0")
     except:
         pass
     img = Image("photo", file = "jojo.gif")
     self.tk.call("wm", "iconphoto", self._w, img)
     self.data = None
     self.frames = {}
     self.record_manager = RecordManager()
     self.init_start_page()
     self.show_frame(MainPage)
Example #13
0
def decision_tree_fun():
    flights = pd.read_csv(january_pca_path)
    flights = flights.fillna(0)

    x = np.array(flights.ix[:, 0:21])
    y = np.array(flights['IS_LATE'])

    X_train, X_test, y_train, y_test = train_test_split(x,
                                                        y,
                                                        test_size=0.3,
                                                        train_size=0.7)
    clf = tree.DecisionTreeClassifier()
    clf.fit(X_train, y_train)
    prediction = clf.predict(X_test)

    accuracy = accuracy_score(y_test, prediction)
    confusion_mat = confusion_matrix(y_test, prediction)
    f1 = f1_score(y_test, prediction)
    precision = precision_score(y_test, prediction)
    recall = recall_score(y_test, prediction)

    print(accuracy)
    print(f1)
    print(precision)
    print(recall)
    print(confusion_mat)

    dot_data = StringIO()
    export_graphviz(clf,
                    out_file=dot_data,
                    filled=True,
                    rounded=True,
                    special_characters=True)

    graph = pydotplus.graph_from_dot_data(dot_data.getvalue())
    Image(graph.create_png())
Example #14
0
 def __init__(self, language='es'):
     self.win = tk.Tk()
     self.i18n = I18N(language)
     self.win.title(self.i18n.title)
     self.win.resizable(1, 1)
     self.win.geometry("1000x600")
     self.pcb = Image("photo", file="Resources/pinguinoChefPanbien.png")
     self.pnv = Image("photo", file="Resources/PinguinoNoVe.png")
     self.pcq = Image("photo", file="Resources/pinguinoChefPanQuemado.png")
     self.img = Image("photo", file="Resources/panque.png")
     self.lpz = Image("photo", file="Resources/lapiz.png")
     self.ojo = Image("photo", file="Resources/ojo.png")
     self.win.tk.call('wm', 'iconphoto', self.win._w, self.img)
     self.call_backs = Callbacks(self)
     # Se llaman metodos que crean los widgets
     self.create_tabs()
     self.create_menubar()
     self.create_tab1()
     self.create_tab2()
     self.create_logo()
     self.total.set("300")
     self.tab_control.select(1)
Example #15
0
from tkinter import Tk, scrolledtext, Menu, filedialog, END, messagebox, simpledialog, Text, PhotoImage, Wm, Image
from pathlib import Path
import os
from functools import partial
# Root for Main Window
root = Tk(className='Text Editor')
textArea = scrolledtext.ScrolledText(root,
                                     width=100,
                                     height=80,
                                     undo=True,
                                     maxundo=-1,
                                     fg="black")
#Setting Icon
iconpath = Path.cwd() / 'icons' / 'te.gif'
ticon = Image('photo', file=str(iconpath))
icon = PhotoImage(str(iconpath))
root.tk.call('wm', 'iconphoto', root._w, ticon)
prevFile = None


# Functions
def newFile():
    if len(textArea.get('1.0', END + '-1c')) > 0:
        if messagebox.askyesno("Save?", "Do you wish to save?"):
            saveFile()
            fileSaved = True
            if fileSaved == True:
                textArea.delete('1.0', END)
                fileSaved = False
        else:
            textArea.delete('1.0', END)
Example #16
0
    def __init__(self, args):
        Tk.__init__(self)
        self.height = '720'
        self.width = '1280'
        self.Editors = []
        self.Filenames = {}
        self.lexer_selector = self.createLexers()
        self.Lexers = dict()
        self._icon = Image("photo", file='img/notebook/icon.png')

        self.code_font = Font(family="Latin Modern Mono", size=15)
        self.title_font = Font(family="Ubuntu Mono", size=15)
        self.underline_font = Font(underline=True)

        self.MainWindow = Frame(self, background='#282c34')
        self.notebook = Notebook(self)
        self.configureUI()
        self.args = args

        self.awk_img = PhotoImage(file='img/fext/awk.png')
        self.bash_img = PhotoImage(file='img/fext/bash.png')
        self.c_img = PhotoImage(file='img/fext/c.png')
        self.cs_img = PhotoImage(file='img/fext/c#.png')
        self.cmake_img = PhotoImage(file='img/fext/cmake.png')
        self.coffee_img = PhotoImage(file='img/fext/coffee.png')
        self.cpp_img = PhotoImage(file='img/fext/cpp.png')
        self.css_img = PhotoImage(file='img/fext/css.png')
        self.delphi_img = PhotoImage(file='img/fext/delphi.png')
        self.eiffel_img = PhotoImage(file='img/fext/eiffel.png')
        self.erlang_img = PhotoImage(file='img/fext/erlang.png')
        self.fs_img = PhotoImage(file='img/fext/f#.png')
        self.fortran_img = PhotoImage(file='img/fext/fortran.png')
        self.go_img = PhotoImage(file='img/fext/golang.png')
        self.haskell_img = PhotoImage(file='img/fext/haskell.png')
        self.html_img = PhotoImage(file='img/fext/html.png')
        self.java_img = PhotoImage(file='img/fext/java.png')
        self.js_img = PhotoImage(file='img/fext/js.png')
        self.json_img = PhotoImage(file='img/fext/json.png')
        self.kotlin_img = PhotoImage(file='img/fext/kotlin.png')
        self.lisp_img = PhotoImage(file='img/fext/lisp.png')
        self.makefile_img = PhotoImage(file='img/fext/makefile.png')
        self.matlab_img = PhotoImage(file='img/fext/matlab.png')
        self.mysql_img = PhotoImage(file='img/fext/mysql.png')
        self.perl_img = PhotoImage(file='img/fext/perl.png')
        self.php_img = PhotoImage(file='img/fext/php.png')
        self.prolog_img = PhotoImage(file='img/fext/prolog.png')
        self.python_img = PhotoImage(file='img/fext/python.png')
        self.ruby_img = PhotoImage(file='img/fext/ruby.png')
        self.sass_img = PhotoImage(file='img/fext/sass.png')
        self.scala_img = PhotoImage(file='img/fext/scala.png')
        self.swift_img = PhotoImage(file='img/fext/swift.png')
        self.tcl_img = PhotoImage(file='img/fext/tcl.png')
        self.ts_img = PhotoImage(file='img/fext/ts.png')
        self.txt_img = PhotoImage(file='img/fext/txt.png')
        self.verilog_img = PhotoImage(file='img/fext/verilog.png')
        self.vhdl_img = PhotoImage(file='img/fext/vhdl.png')
        self.xml_img = PhotoImage(file='img/fext/xml.png')
        self.yaml_img = PhotoImage(file='img/fext/yaml.png')

        for file_name in self.args:
            self.openFileByName(file_name)

        self.mainloop()
Example #17
0
# -*- coding: utf-8 -*-
"""Lancement du programme par le fichier main. L'interface est lancée par défaut dans une boucle mainloop"""
import time  # Pour execution time
from tkinter import Image

import interface

start_time = time.time()

# Lancement de la boucle principale de l'interface graphique
if __name__ == "__main__":
    """Boucle de lancement de l'application"""
    app = interface.MaFen()
    img = Image("photo", file="Images/icon.png")
    app.tk.call('wm', 'iconphoto', app._w, img)
    app.mainloop()

print("Process Finished\nExecution time : ")
print("--- %s seconds ---" % (time.time() - start_time))
del start_time