irfpy.util.tk

Tkinter helper module.

Code author: Yoshifumi Futaana

class irfpy.util.tk.ToplevelFrame(Frame_cls, master=None)[source]

Bases: Toplevel

Using Tk.Frame class, instance Toplevel object.

+----- master (If given) -------------------+
| +----- ToplevelFrame -> Tk.Toplevel ----+ |
| |  +--- Frame -> Tk.Frame -----------+  | |
| |  |                                 |  | |
| |  +---------------------------------+  | |
| +---------------------------------------+ |
+-------------------------------------------+

Create the Toplevel derivative object from Frame derivative class

Parameters:

Frame_cls – Derivative class of Tk.Frame. Not instance/object!!

# Usual way of instance Frame
class MyFrame (Tk.Frame):
    def __init__(self, master=None):
        Tk.Frame.__init__(self, master)
        b = Tk.Button(self, text='OK')
        b.pack()

# For usual usage
tk = Tk.Tk()
tp = Tk.Toplevel(tk)
f = MyFrame(tp)
f.pack()
tk.mainloop()

# For using this class
tk = Tk.Tk()
tp = ToplevelFrame(MyFrame, master=tk)
tk.mainloop()
irfpy.util.tk.functoplevel(frame_cls, master=None)[source]

Return the function that returns Toplevel instance from frame class.

This can be used as an argument for “command” option!

class irfpy.util.tk.PyanaFrame(master=None)[source]

Bases: Frame

Abstract frame for general use.

The frame is intended to specify paramters for plots.

Therefore, in the bottom, two buttons “Plot” and “Close” are placed by default.

You have to define the following three methods, at least

See How to make a gui software for details.

Construct a frame widget with the parent MASTER.

Valid resource names: background, bd, bg, borderwidth, class, colormap, container, cursor, height, highlightbackground, highlightcolor, highlightthickness, relief, takefocus, visual, width.

abstract framename()[source]

Return a short string showing frame name

abstract create_widget()[source]

Define all the widget below self.mf (Tk.Frame).

Here you may define all the widget, and connect to commands. All the widget is intended to be placed under the Tk.Frame object, named self.mf.

abstract go()[source]

Go function. Called from “Go” button.

quit()[source]

Quit function. Default is self.master.destroy

irfpy.util.tk.doctests()[source]