Example #1
0
    def __init__(self):
        self.database = Database()
        self.table_name = None
        self.table_checksum = None
        self.refresh_rate = REFRESH_RATE
        self.timestamp = None
        self.config = None
        self.problem_cfg = None
        self.agent = None
        self.scheduler = None

        self.root = tk.Tk()
        self.root.title('AutoOED')
        self.root.protocol('WM_DELETE_WINDOW', self._quit_init)
        self.root.resizable(False, False)
        self.root.iconphoto(True, tk.Image('photo', file=get_icon_path()))

        self.view = GUIInitView(self.root)
        self.view.widget['manage_problem'].configure(
            command=self.manage_problem)
        self.view.widget['create_experiment'].configure(
            command=self.create_experiment)
        self.view.widget['load_experiment'].configure(
            command=self.load_experiment)
        self.view.widget['remove_experiment'].configure(
            command=self.remove_experiment)

        center(self.root)
        self.root.mainloop()
Example #2
0
    def create_app(self):  # noqa
        app = tkinter.Tk()

        # fix: askopenfiles dialog on linux by default shows white fg (foreground) on white bg
        # explicitely set foreground for TkFDialog to black.
        app.option_add('*TkFDialog*foreground', '#000000')
        app.option_add('*TkFDialog*background', '#dddddd')

        pad = 3
        screen_width = app.winfo_screenwidth() - pad
        screen_height = app.winfo_screenheight() - pad
        geometry = '{}x{}+0+0'.format(screen_width, screen_height)
        app.geometry(geometry)
        app.title('Impartus Downloader')
        app.rowconfigure(0, weight=0)
        app.rowconfigure(1, weight=1)
        app.columnconfigure(0, weight=1)

        img = tk.Image("photo", file='etc/id.png')
        app.iconphoto(True, img)

        conf = Config.load(ConfigType.IMPARTUS)
        content_font = conf.get('content_font').get(platform.system())
        content_font_size = conf.get('content_font_size')

        default_font = font.nametofont("TkDefaultFont")
        default_font.configure(family=content_font, size=content_font_size)
        text_font = font.nametofont("TkTextFont")
        text_font.configure(family=content_font, size=content_font_size)

        return app
Example #3
0
def retrieve_result_plot(result_dir, result_file, plot_file, output_file):
    os.system(
        "root -l -b -q 'extractPlots.cpp(\"{0}\", \"{1}\", \"{2}\")'".format(
            result_dir + result_file, plot_file, output_file))
    result_image = tk.Image('photo',
                            file=output_file)  #FIXME: update to using pillow
    return result_image
Example #4
0
def main():
    """Run the GUI."""

    root = tk.Tk(className="NIClassify")

    root.style = ttk.Style()
    app = ClassifierTool(root, StandardProgram, RandomForestAC, utilities)
    root.update()
    root.minsize(root.winfo_width(), root.winfo_height())
    root.iconbitmap(utilities.PROGRAM_ICON)
    if utilities.PLATFORM == 'Linux':
        img = tk.Image("photo", utilities.PLATFORM[1:-4] + ".png")
        root.tk.call('wm', 'iconphoto', root._w, img)

    def graceful_exit():
        """
        Exit the program gracefully.

        This includes cleaning tempfiles and closing any processes.
        """
        try:
            app.tempdir.cleanup()
        except PermissionError:
            None
        plt.close("all")
        root.quit()
        root.destroy()

    root.protocol("WM_DELETE_WINDOW", graceful_exit)

    root.mainloop()
Example #5
0
 def open_window(self, message):
     w_alert = tk.Toplevel(self.main)
     w_alert.wm_title("Attenzione")
     icon = tk.Image("photo", file="/usr/share/icons/sodilinux2017.png")
     w_alert.tk.call('wm','iconphoto',w_alert,icon)
     l = tk.Label(w_alert, text=message)
     l.pack(side="top", fill="both", expand=True)
     return w_alert
Example #6
0
 def set_dock_icon(self) -> None:
     # make Karel dock icon image
     path = Path(__file__).absolute().parent / "icon.png"
     try:
         img = tk.Image("photo", file=path)
         self.master.tk.call("wm", "iconphoto", self.master._w, img)  # type: ignore
     except tk.TclError:
         print(f"Warning: invalid icon.png: {path}")
Example #7
0
 def set_icon(self):
     if 'win32' in sys.platform:
         icon_ = os.path.join(config.CODEPATH, 'res', 'icon3.ico')
         self.root.iconbitmap(default=icon_)
     elif 'linux' in sys.platform:
         img_ = tk.Image('photo',
                         file=os.path.join(config.CODEPATH, 'res',
                                           'icon3.png'))
         self.root.tk.call('wm', 'iconphoto', self.root._w, img_)
Example #8
0
def launchEntryApp():
    root = tk.Tk()
    root.title("Insta'mag")
    root.geometry("400x500")
    img = tk.Image("photo", file="icon_insta_mag.icns")
    # root.iconphoto(True, img) # you may also want to try this.
    root.tk.call('wm', 'iconphoto', root._w, img)
    GUI(root)
    tk.mainloop()
Example #9
0
 def __create_bitmaps() :
     if not tk._default_root :
         root = tk.Tk()
         root.wm_state("withdrawn")
         tk._default_root = root
     Calc._bm_pi = tk.Image("bitmap")
     Calc._bm_pi["data"] = """
         #define bm_pi_width 16
         #define bm_pi_height 16
         static char bm_pi_bits[] = {
             0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
             0xfe, 0x3f, 0x12, 0x04, 0x10, 0x04, 0x10, 0x04,
             0x10, 0x04, 0x10, 0x04, 0x10, 0x04, 0x10, 0x04,
             0x10, 0x04, 0x10, 0x04, 0x1c, 0x04, 0x00, 0x00
         };
     """
     Calc._bm_sqrt = tk.Image("bitmap")
     Calc._bm_sqrt["data"] = """
Example #10
0
 def createTopWindow(self, width, height, title):
     top = Toplevel(self.bottom)
     self.setWindowSize(top, width, height)
     top.title(title)
     top.protocol("WM_DELETE_WINDOW", lambda: self.destroyWindow(top))
     top.tk.call('wm', 'iconphoto', top._w,
                 tkinter.Image("photo", data=self.libs.gif_icon))
     self.window_levels.append(top)
     return top
 def set_dock_icon(self) -> None:
     # make Karel dock icon image
     path = Path(__file__).absolute().parent / "icon.png"
     try:
         img = tk.Image("photo", file=path)
         # pylint: disable=protected-access
         self.master.tk.call("wm", "iconphoto", self.master._w,
                             img)  # type: ignore[attr-defined] # noqa: E501
     except tk.TclError:
         print(f"Warning: invalid icon.png: {path}")
Example #12
0
 def __init__(self):
     self.root = tk.Tk()
     self.root.title('Liquid Galaxy Network Diagnostics Tool')
     self.root.protocol('WM_DELETE_WINDOW', self.on_close)
     self.status_widgets = {}
     self.create_widgets()
     self.checker = None
     self.queue = Queue()
     self.root.call('wm', 'iconphoto', self.root._w,
                    tk.Image('photo', file='logo-small.png'))
Example #13
0
 def __init__(self, parent):
     icon = tkinter.Image(
         'photo',
         file=os.path.join(os.path.dirname(__file__), 'icon.png'))
     tkinter.Frame.__init__(self,parent)
     self.parent = parent
     self.parent.wm_title("Task Adder")
     self.customFont = tkinter.font.Font(size=24)
     self.parent.call('wm', 'iconphoto', self.parent._w, icon)
     self.initialize()
Example #14
0
 def __init__(self):
     self.version = "beta"
     self.variable_init()
     self.help_url = "https://circuit-specialists.github.io/PowerSupply_ElectronicLoad_Control/"
     self.bottom = tkinter.Tk(className=' cs power control')
     self.libs = lib.RESOURCES()
     self.bottom.tk.call('wm', 'iconphoto', self.bottom._w,
                         tkinter.Image("photo", data=self.libs.gif_icon))
     self.bottom.title('Circuit Specialists Power Control')
     self.setWindowSize(self.bottom, 700, 500)
     self.setMenuBar()
     self.drawMainFrame()
Example #15
0
    def __init__(self, *args, **kwargs):
        tk.Tk.__init__(self, *args, **kwargs)
        # Shareable Variables
        self.filename = ""
        self.dataframe = pd.DataFrame()
        self.account_dict = dict()
        self.simple_cat = top7_list
        self.category_dict = {cat: tk.IntVar(value=1) for cat in top7_list}
        self.categoryName_dict = {
            cat3: tk.StringVar(value=cat3)
            for cat3 in top7_list
        }
        self.budget_dict = {
            cat2: tk.DoubleVar(value=0.0)
            for cat2 in top7_list
        }
        self.budget_dict.update({"Savings": tk.DoubleVar(value=0.0)})
        self.budgetName_dict = {
            cat3: tk.StringVar(value=cat3, name=cat3)
            for cat3 in top7_list
        }
        self.budgetName_dict.update(
            {"Savings": tk.StringVar(value="Savings", name="Savings")})
        self.price_dict = pd.DataFrame()

        p1 = tk.Image('photo', file='wallet.png')

        # Setting icon of master window
        self.call('wm', 'iconphoto', self._w, p1)
        tk.Tk.wm_title(self, "Budget App")

        # Create container for window frames
        container = tk.Frame(self)
        container.pack(side="top", fill="both", expand=True)
        container.grid_rowconfigure(0, weight=1)
        container.grid_columnconfigure(0, weight=1)

        # Create dictionary of frames for later use
        self.frames = {}

        # Add all pages to dictionary
        for F in (StartPage, BudgetPage):
            frame = F(container, self)
            self.frames[F] = frame

            # make frame take up all space
            frame.grid(row=0, column=0, sticky="nsew")

        # show the starting page
        self.show_frame(StartPage)
def launch_tk_gui(bk, prefs):
    root = tkinter.Tk()
    root.withdraw()
    root.title('')
    root.resizable(True, True)
    root.minsize(440, 420)
    if not sys.platform.startswith('darwin'):
        img = tkinter.Image('photo',
                            file=os.path.join(bk._w.plugin_dir,
                                              bk._w.plugin_name,
                                              'images/icon.png'))
        root.tk.call('wm', 'iconphoto', root._w, img)
    guiMain(root, bk, prefs).pack(fill=tkinter.constants.BOTH, expand=True)
    root.mainloop()
Example #17
0
    def __init__(self, master):
        self.master = master
        master.protocol("WM_DELETE_WINDOW", self.quit)
        master.title("Roman - A+ LMS course builder")
        img_file = resource_path('roman.png')
        if isfile(img_file):
            master.call('wm', 'iconphoto', master._w, tk.Image("photo", file=img_file))

        self.settings = Settings(__roman_id__, 'roman_tki.ini')
        self.settings.set_defaults('window', (('geometry', ''),))
        self.settings.set_defaults('course', (('lasttime', ''),))

        cols = 5

        self.initial_dir = expanduser("~")
        self.config_dir = None
        self.config = None
        self.engine = None
        self.build_task = None

        self.label = tk.Label(master, text="No course selected!")
        self.label.grid(columnspan=cols, sticky=tk.W)

        # Buttons
        self.course_btn = tk.Button(master, text="Open course", command=self.open)
        self.course_btn.grid(row=1)
        self.load_btn = tk.Button(master, text="Load conf", command=self.load, state=tk.DISABLED)
        self.load_btn.grid(row=1, column=1)
        self.build_btn = tk.Button(master, text="Build course", command=self.build, state=tk.DISABLED)
        self.build_btn.grid(row=1, column=2)
        self.validate_btn = tk.Button(master, text="Validate yaml", command=self.build, state=tk.DISABLED)
        self.validate_btn.grid(row=1, column=3)
        self.close_btn = tk.Button(master, text="Quit", command=self.quit)
        self.close_btn.grid(row=1, column=4)

        # Console output
        self.console = Console(master)
        self.console.grid(columnspan=cols, row=2)

        # Progress
        self.progress = Progress(master)
        self.progress.grid(columnspan=cols, row=3, sticky=tk.W+tk.E)

        # Status line
        self.status = tk.Label(master, text="", bd=1, relief=tk.SUNKEN, anchor=tk.W)
        self.status.grid(columnspan=cols, row=4, sticky=tk.W+tk.E+tk.S)

        self.set_status("No course selected")
        self.restore()
        self.load_engine()
Example #18
0
 def __init__(self):
     self.root_window = root = tkinter.Tk()
     root.withdraw()
     os.chdir(os.environ['HOME'])
     os.makedirs(jupyter_runtime_dir, mode=0o755, exist_ok=True)
     self.icon = tkinter.Image("photo", file=self.icon_file)
     root.tk.call('wm', 'iconphoto', root._w, self.icon)
     self.menubar = menubar = tkinter.Menu(root)
     apple_menu = tkinter.Menu(menubar, name="apple")
     apple_menu.add_command(label='About SageMath ...',
                            command=self.about_sagemath)
     menubar.add_cascade(menu=apple_menu)
     root.config(menu=menubar)
     ttk.Label(root, text="SageMath 9.4").pack(padx=20, pady=20)
Example #19
0
    def create_mf(self, filename):
        f = open(f"{Alp.CONF_DIR}/{filename}", "r")
        j = json.load(f)
        alp = Alp()
        alp.load_widgets(self, j)

        mf = tkinter.Frame(master=self)
        mf.pack()

        mf.exit = tkinter.Button(mf, text="終了", fg="red",
                                 command=self.destroy)
        mf.exit.pack(side="bottom")

        img = tkinter.Image("photo", file=f"{Alp.CONF_DIR}/gracie.png")
        self.tk.call('wm', 'iconphoto', self._w, img)
Example #20
0
    def __init__(self, master):
        ttk.Frame.__init__(self, master)
        settings.init()
        self.queue = queue.Queue()
        width, height, x, y = settings.center(master, 'master', 525, 355)
        master.geometry('%dx%d+%d+%d' % (width, height, x, y))
        self.master.configure(background='#333333')
        self.master.title("Spinrite USB Creator")
        img = tk.Image("photo", file=settings.ICON)
        self.tk.call('wm', 'iconphoto', root._w, img)
        # causes the full width of the window to be used
        self.columnconfigure(2, weight=1)
        self.columnconfigure(1, weight=1)

        self.make_UI()
Example #21
0
 def create_UI(self):
     # Create main window
     self.mainWindow = tk.Tk()
     self.mainWindow.title(APP_NAME)
     img = tk.Image("photo",
                    file=currentdir + '/assets/trading_mate_icon.png')
     self.mainWindow.tk.call('wm', 'iconphoto', self.mainWindow._w, img)
     self.mainWindow.protocol("WM_DELETE_WINDOW", self.on_close_event)
     self.mainWindow.geometry("1024x600")
     # Define the app menu
     self.create_menu()
     # Create the tab format window
     self.noteBook = ttk.Notebook(self.mainWindow)
     self.noteBook.pack(expand=1, fill="both")
     # Create Share trading Tab
     self.create_share_trading_tab()
Example #22
0
    def __init__(self, master):
        tk.Frame.__init__(self, master)
        tk.Label(self, text="Welcome to Texas Holdem App from Team1").pack(
            side="top", fill="x", pady=10)
        tk.Entry(self, show="Login here").pack(side="top", fill="x", pady=11)
        tk.Button(self,
                  text="Login",
                  command=lambda: master.switch_frame(InGamePage).bind(
                      "<Button-1>", log_in)).pack()

        tk.Button(self,
                  text="Join Game",
                  command=lambda: master.switch_frame(InGamePage).bind(
                      "<Button-1>", join_game)).pack()

        tk.Image(self, command=open("img//texas-holdem-poker.png"))
Example #23
0
def initialize_gui(task_controller: TaskController) -> None:
    """

    :param task_controller: TaskController Object
    :return: None
    """

    root = tk.Tk()
    root.title("Tasks")

    icon = tk.Image(imgtype="photo", file="src/ico.png")
    root.iconphoto(True, icon)

    _ = TasksGUI(master=root, task_controller=task_controller)

    root.mainloop()
Example #24
0
    def _setIcon(self, icon):

        if icon is not None:
            try:
                path = pw.findResource(icon)
                # If path is None --> Icon not found
                if path is None:
                    # By default, if icon is not found use default scipion one.
                    path = pw.findResource(Icon.SCIPION_ICON)

                abspath = os.path.abspath(path)

                img = tk.Image("photo", file=abspath)
                self.root.tk.call('wm', 'iconphoto', self.root._w, img)
            except Exception as e:
                # Do nothing if icon could not be loaded
                pass
Example #25
0
    def __init__(self):
        self.root = tkinter.Tk()
        self.root.geometry('400x600')
        self.root.title('Phone Drop')
        self.root.config(background='white')
        self.icon = tkinter.Image("photo",
                                  file=os.path.join(os.path.dirname(__file__),
                                                    "static/icon.png"))
        self.root.tk.call('wm', 'iconphoto', self.root._w, self.icon)
        self.canvas = tkinter.Canvas(self.root,
                                     width=400,
                                     height=400,
                                     bg='white',
                                     bd=0,
                                     highlightthickness=0,
                                     relief='ridge')
        self.canvas.pack()
        self.image = ImageTk.PhotoImage(get_qr_code(ip=get_interfaces()[0][1]))
        self.imagesprite = self.canvas.create_image(200, 200, image=self.image)
        self.iflabel = ttk.Label(self.root,
                                 text="Select network interface",
                                 background='white',
                                 padding=(0, 0, 0, 10))
        self.ifvar = tkinter.StringVar()
        self.ifvar.set("%s: %s" % get_interfaces()[0])
        self.iflabel.pack()
        self.ifselect = tkinter.OptionMenu(
            self.root,
            self.ifvar,
            *["%s: %s" % i for i in get_interfaces()],
            command=self.handle_if_select)
        self.ifselect.pack()

        self.path = ttk.Label(self.root,
                              text="Dropping to %s" %
                              get_config().UPLOAD_FOLDER,
                              background='white',
                              padding=(0, 30, 0, 10))
        self.path.pack()
        self.B = tkinter.Button(self.root,
                                text="Select drop dir",
                                command=self.set_upload_dir,
                                highlightthickness=0)
        self.B.pack()
Example #26
0
    def __init__(self, master):
        ttk.Frame.__init__(self, master)
        settings.init()
        mixer.init()

        width, height, x, y = settings.center(master, 'master', 525, 355)
        master.geometry('%dx%d+%d+%d' % (width, height, x, y))
        self.master.configure(background='#333333')
        self.master.title("Compression Tool")
        img = tk.Image("photo", file=settings.ICON)
        self.tk.call('wm','iconphoto',root._w,img)
        self.browse_files = {}
        self.sound = {}
        self.item_id = {}
        # causes the full width of the window to be used
        self.columnconfigure(2, weight=1)
        self.columnconfigure(1, weight=1)

        self.make_UI()
Example #27
0
    def about(self):
        "Fenêtre About"

        self.fenetre_about = Toplevel()  #Définition de la fenêtre
        self.fenetre_about.title('À propos')
        self.fenetre_about.geometry('250x150')
        icon = tkinter.Image("photo",
                             file='icons/about.gif')  #Fichier de l'icône
        self.fenetre_about.tk.call('wm', 'iconphoto', self.fenetre_about._w,
                                   icon)
        self.fenetre_about.resizable(width=False, height=False)
        self.fenetre_about.transient(self.fenetre_pendule)
        self.fenetre_about.grab_set()
        font = tkFont.Font(size=13)
        Label(self.fenetre_about,
              text='Développé avec amour\npar Marc-Antoine GODDE',
              font=font).pack(padx=5, pady=10)
        Label(self.fenetre_about, text='Copyright © 2019').pack(padx=5, pady=5)
        self.bouton_ok = Button(self.fenetre_about,
                                text='Ok',
                                command=self.fenetre_about.destroy).pack(
                                    padx=5, pady=5)
Example #28
0
    def __init__(self, master=None, **kwargs):
        """Initalizates the app"""
        tkinter.Frame.__init__(self, master, **kwargs)

        self.master.wm_title("ComplexArchitect")
        self.master.resizable(width=True, height=True)
        logo = tkinter.Image("photo",
                             file=os.path.dirname(os.path.realpath(__file__)) +
                             "/logo.png")
        self.master.iconphoto(False, logo)

        self.master.geometry("1000x500")

        #DEFINE ATTRIBUTES
        self.seq_list = []
        self.global_frequencies = {}
        self.seq_listbox = None

        self.menubar = None
        self.options = None
        self.sequence_text = None

        self.createWidgets()
Example #29
0
    def __init__(self):
        self.root = tk.Tk()
        self.root.title("Omo Trainer")
        try:
            img = tk.Image("photo", file="icon.png")
            self.root.call('wm', 'iconphoto', self.root._w, img)
        except tk.TclError:
            # If the icon is missing, just go on with the default icon
            pass

        self.drinker = omo.Drinker()

        self.load_data()

        # Initialize GUI property variables
        self.desperation = tk.DoubleVar()

        self.drink_amount = tk.IntVar()
        self.drink_amount.set(300)

        self.bladder_text = tk.StringVar()
        self.drink_text = tk.StringVar()
        self.permission_text = tk.StringVar()
        self.eta_text = tk.StringVar()
        self.accident_text = tk.StringVar()
        self.trainer_text = tk.StringVar()
        self.accident_text_template = "Accidents: {0}"
        self.drinker_name = tk.StringVar()
        self.trainer_text = tk.StringVar()

        self.trainer = trainer.Trainer()

        self.create_widgets()
        self.create_menus()

        self.poll()
Example #30
0
    def _build_icons(self):
        if sys.platform == 'darwin':
            try:
                self.compress_icon = tk.Image(
                    'nsimage',
                    source='NSExitFullScreenTemplate',
                    width=18,
                    height=18)
                self.expand_icon = tk.Image('nsimage',
                                            source='NSEnterFullScreenTemplate',
                                            width=18,
                                            height=18)
            except tk.TclError:
                self.compress_icon = tk.Image('photo',
                                              width=18,
                                              height=18,
                                              file=os.path.join(
                                                  os.path.dirname(__file__),
                                                  'inward18.png'))

                self.expand_icon = tk.Image('photo',
                                            width=18,
                                            height=18,
                                            file=os.path.join(
                                                os.path.dirname(__file__),
                                                'outward18.png'))
        else:
            suffix = 'gif' if tkinter.TkVersion < 8.6 else 'png'
            self.compress_icon = tk.Image('photo',
                                          width=18,
                                          height=18,
                                          file=os.path.join(
                                              os.path.dirname(__file__),
                                              'inward18.' + suffix))

            self.expand_icon = tk.Image('photo',
                                        width=18,
                                        height=18,
                                        file=os.path.join(
                                            os.path.dirname(__file__),
                                            'outward18.' + suffix))