Пример #1
0
 def configure_subplots(self):
     toolfig = Figure(figsize=(6, 3))
     window = Tk.Toplevel()
     canvas = type(self.canvas)(toolfig, master=window)
     toolfig.subplots_adjust(top=0.9)
     canvas.tool = SubplotTool(self.canvas.figure, toolfig)
     canvas.draw()
     canvas.get_tk_widget().pack(side=Tk.TOP, fill=Tk.BOTH, expand=1)
     window.grab_set()
Пример #2
0
 def create_parameter_frame(self):
   """ Define the parameter window
   """
   #print("dbg414: create_parameter_frame")
   self.frame_c = tkinter.Toplevel(self.frame_a)
   self.frame_c.title("parameter info")
   self.parameter_message = tkinter.Message(self.frame_c, textvariable=self.parameter_content)
   self.parameter_message.grid(sticky=tkinter.N+tkinter.E+tkinter.S+tkinter.W)
   self.frame_c.protocol("WM_DELETE_WINDOW", self.hide_parameter_frame) # change the behaviour of the window X button
Пример #3
0
 def show_about(self):
     """
     Display an About dialogue box.
     """
     toplevel = tk.Toplevel(self.master, bg='white')
     toplevel.transient(self.master)
     toplevel.title('About')
     tk.Label(toplevel, text='A simple iris viewer', fg='navy', bg='white').pack(pady=20)
     tk.Label(toplevel, text="Based on Scitools' Iris", bg='white').pack()
     tk.Button(toplevel, text='Close', command=toplevel.withdraw).pack(pady=30)
Пример #4
0
    def open_window(self):
        if self.window:
            return

        # Taco3d window and mpl figure
        self.window = Tk.Toplevel()
        self.window.protocol('WM_DELETE_WINDOW', self.destroy)
        fig = Figure(figsize=(5,5), dpi=100)
        self.canvas = FigureCanvasTkAgg(fig, master=self.window)
        self.canvas.get_tk_widget().pack(side=Tk.LEFT)
        self.ax = fig.add_axes([0.05, 0.05, 0.9, 0.9], projection='3d', azim=0.0, elev=0.0)
        self.draw_taco3d()
        self.canvas.show()
Пример #5
0
def show_info(*args):
    if list_box.curselection():
        cs_name = list_box.get(list_box.curselection())
        cs = cardsets_dict[cs_name]
        fn = os.path.join(cs.dir, 'COPYRIGHT')
        top = tkinter.Toplevel()
        text = tkinter.Text(top)
        text.insert('insert', open(fn).read())
        text.pack(expand=tkinter.YES, fill=tkinter.BOTH)
        b_frame = tkinter.Frame(top)
        b_frame.pack(fill=tkinter.X)
        button = tkinter.Button(b_frame, text='Close', command=top.destroy)
        button.pack(side=tkinter.RIGHT)
Пример #6
0
    def __init__(self, parent, opname, **kwargs):
        self.toplevel = tk.Toplevel(parent, **kwargs)
        self.toplevel.transient(parent)

        self.opname = opname

        self.label = tk.Label(self.toplevel, text=opname)
        self.label.pack()

        self.progress = ttk.Progressbar(self.toplevel,
                                        orient='horizontal',
                                        mode='indeterminate')

        self.progress.pack(expand=True, fill=tk.BOTH, side=tk.TOP)
Пример #7
0
def makeToplevel(parent, title=None):
    # Create a Toplevel window.
    #
    # This is a shortcut for a Toplevel() instantiation plus calls to
    # set the title and icon name of the window.
    window = tkinter.Toplevel(parent)  # , class_=TITLE)
    # window.wm_group(parent)
    # window.wm_command("")
    if WIN_SYSTEM == "x11":
        window.wm_command("/bin/true")
    # window.wm_protocol("WM_SAVE_YOURSELF", None)
    if title:
        window.wm_title(title)
        window.wm_iconname(title)
    return window
Пример #8
0
		def add_window(self, img, title):
			window   = tkinter.Toplevel()
			window.minsize(img.width, img.height)
			window.title(title)
			canvas = tkinter.Canvas(window, width=img.width, height=img.height)
			canvas.pack()
			canvas.configure(background="white")
			photo  = ImageTk.PhotoImage(img)
			sprite = canvas.create_image(0, 0, image=photo, anchor=tkinter.NW)
			self.windows.append([window,canvas,photo,sprite])
			def closer():
				self.nclosed += 1
				window.destroy()
				if self.nclosed >= len(self.windows): self.root.destroy()
			window.protocol("WM_DELETE_WINDOW", closer)
Пример #9
0
        def ask_password(master):
            tl = tk.Toplevel(master)
            tl.transient(master)

            ff = form.FormFrame(tl)
            pf = form.PasswordField('enter iRODS password:',
                                    return_cb=tl.destroy)
            ff.grid_fields([pf])
            ff.pack()

            tl.wait_window()

            scrambled_password = iRODSCatalog.encode(pf.to_string())

            return iRODSCatalog(host, port, user, zone, scrambled_password)
Пример #10
0
def show_config():
    if list_box.curselection():
        cs_name = list_box.get(list_box.curselection())
        card_set = cardsets_dict[cs_name]

        file_name = os.path.join(card_set.cs_dir, 'config.txt')

        top = tkinter.Toplevel()
        text = tkinter.Text(top)
        text.insert('insert', open(file_name).read())
        text.pack(expand=tkinter.YES, fill=tkinter.BOTH)

        b_frame = tkinter.Frame(top)
        b_frame.pack(fill=tkinter.X)
        button = tkinter.Button(b_frame, text='Close', command=top.destroy)
        button.pack(side=tkinter.RIGHT)
Пример #11
0
 def create_zoom_frame(self):
   """ Define the zoom window
   """
   #print("dbg554: create_zoom_frame")
   self.frame_b = tkinter.Toplevel(self.frame_a)
   #self.frame_b.grid(column=0, row=0, sticky=Tkinter.N+Tkinter.E+Tkinter.S+Tkinter.W) # Toplevel doesn't have grid method !
   #self.frame_b.pack(fill=Tkinter.BOTH, expand=1)
   self.frame_b.title("cnc25d display backend details")
   self.canvas_b = tkinter.Canvas(self.frame_b, width=initial_tkinter_canvas_width, height=initial_tkinter_canvas_height)
   #self.canvas_b.grid(column=0, row=0, sticky=Tkinter.N+Tkinter.E+Tkinter.S+Tkinter.W)
   #self.canvas_b.columnconfigure(0, weight=1)
   #self.canvas_b.rowconfigure(0, weight=1)
   self.canvas_b.pack(fill=tkinter.BOTH, expand=1) # with Toplevel parent, it seems you need to use pack to resisze the canvas !
   self.canvas_b.bind("<ButtonPress-1>", self.action_canvas_b_mouse_button_press)
   self.canvas_b.bind("<B1-Motion>", self.action_canvas_b_mouse_button_motion)
   self.canvas_b.bind("<ButtonRelease-1>", self.action_canvas_b_mouse_button_release)
   self.frame_b.protocol("WM_DELETE_WINDOW", self.hide_zoom_frame) # change the behaviour of the window X button
Пример #12
0
 def history_present(self, history):
     window = tkinter.Toplevel(self.tk)
     listbox = tkinter.Listbox(window)
     listbox.pack(side=tkinter.LEFT, fill=tkinter.BOTH, expand=1)
     scrollbar = tkinter.Scrollbar(window, orient=tkinter.VERTICAL)
     scrollbar.config(command=listbox.yview)
     scrollbar.pack(side=tkinter.RIGHT, fill=tkinter.Y)
     listbox.config(yscrollcommand=scrollbar.set)
     # insert data
     items = history.getlist()
     for line in items:
         listbox.insert(tkinter.END, line)
     listbox.bind(
         "<Double-Button-1>", lambda e: self._history_selected(
             window, items, listbox.curselection()))
     listbox.bind(
         "<Return>", lambda e: self._history_selected(
             window, items, listbox.curselection()))
     listbox.focus_set()
Пример #13
0
    def __init__(self, parent, opname, **kwargs):
        self.maximum = 100
        self.toplevel = tk.Toplevel(parent, **kwargs)
        self.toplevel.transient(parent)

        self.opname = opname

        self.count = tk.IntVar()

        self.label = tk.Label(self.toplevel, text=opname + ' progress: 0%')
        self.label.pack()

        self.progress = ttk.Progressbar(self.toplevel,
                                        orient='horizontal',
                                        mode='determinate',
                                        variable=self.count,
                                        maximum=self.maximum)

        self.progress.pack(expand=True, fill=tk.BOTH, side=tk.TOP)
Пример #14
0
        def ask_password(master):
            cancelled = {'cancelled': False}

            def _do_ok(e=None):
                tl.destroy()

            def _do_cancel(e=None):
                pf.from_string('')
                cancelled['cancelled'] = True
                tl.destroy()

            tl = tk.Toplevel(master)
            tl.title('iRODS password')
            tl.transient(master)

            ff = form.FormFrame(tl)
            pf = form.PasswordField('password for {}@{}:'.format(user, zone),
                                    return_cb=_do_ok)
            ff.grid_fields([pf])
            ff.pack()

            butbox = tk.Frame(tl)
            butbox.pack()
            ok = tk.Button(butbox, text='Ok', command=_do_ok)
            ok.grid()
            ok.bind('<Return>', _do_ok)
            cancel = tk.Button(butbox, text='Cancel', command=_do_cancel)
            cancel.grid(row=0, column=1)
            cancel.bind('<Return>', _do_cancel)

            tl.wait_window()

            if cancelled['cancelled']:
                return None

            scrambled_password = iRODSCatalogBase.encode(pf.to_string())

            return iRODSCatalog4.from_options(host, port, user, zone,
                                              scrambled_password, default_resc,
                                              local_checksum,
                                              default_hash_scheme,
                                              authentication_scheme, ssl)
Пример #15
0
    def show_auth_window(self):
        """ Create and display an Auth window if not authed. """
        if not self.authorization:
            self.main_win.toggle_auth_button(True)
            self.main_win.lbl_loggedin.set('Not logged in.')

            diag_root = Tk.Toplevel(self.main_tk, {'name': 'auth_window'})
            diag_root.grab_set()
            self.busyman.busy()
            self.busyman.unbusy(diag_root)

            AuthDialog(diag_root, self)
            center_toplevel(diag_root)

            self.main_tk.wait_window(diag_root)

            self.main_tk.grab_release()
            self.busyman.unbusy()
            return True
        return False
Пример #16
0
 def showtip(self, text):
     "Display text in tooltip window"
     self.text = text
     if self.tipwindow or not self.text:
         return
     x, y, _, _ = self.widget.bbox("insert")
     x = x + self.widget.winfo_rootx() + 27
     y = y + self.widget.winfo_rooty()
     self.tipwindow = tw = Tk.Toplevel(self.widget)
     tw.wm_overrideredirect(1)
     tw.wm_geometry("+%d+%d" % (x, y))
     try:
         # For Mac OS
         tw.tk.call("::tk::unsupported::MacWindowStyle",
                    "style", tw._w,
                    "help", "noActivates")
     except Tk.TclError:
         pass
     label = Tk.Label(tw, text=self.text, justify=Tk.LEFT,
                      background="#ffffe0", relief=Tk.SOLID, borderwidth=1)
     label.pack(ipadx=1)
Пример #17
0
 def _showTip(self):
     self.timer = None
     if self.tooltip or not self.text:
         return
     #  if isinstance(self.widget, (tkinter.Button, tkinter.Checkbutton)):
     #      if self.widget["state"] == 'disabled':
     #          return
     # x = self.widget.winfo_rootx()
     x = self.widget.winfo_pointerx()
     y = self.widget.winfo_rooty() + self.widget.winfo_height()
     x += self.xoffset
     y += self.yoffset
     self.tooltip = tkinter.Toplevel()
     self.tooltip.wm_iconify()
     self.tooltip.wm_overrideredirect(1)
     self.tooltip.wm_protocol("WM_DELETE_WINDOW", self.destroy)
     self.label = tkinter.Label(self.tooltip, text=self.text,
                                relief=self.relief, justify=self.justify,
                                fg=self.fg, bg=self.bg, bd=1, takefocus=0)
     self.label.pack(ipadx=1, ipady=1)
     self.tooltip.wm_geometry("%+d%+d" % (x, y))
     self.tooltip.wm_deiconify()
     self.cancel_timer = after(
         self.widget, self.cancel_timeout, self._leave)
Пример #18
0
def make_help_toplevel(app, title=None):
    # Create an independent Toplevel window.
    from pysollib.winsystems import init_root_window
    window = tkinter.Toplevel(class_=TITLE)
    init_root_window(window, app)
    return window