Ejemplo n.º 1
0
    def __init__(self, master=None, **opt):
        opt.setdefault('width', 800)
        opt.setdefault('height', 600)
        opt.setdefault('bg', 'white')
        opt.setdefault('bd', 0)
        opt.setdefault('highlightthickness', 0)
        opt.setdefault('scrollregion',
                       (-50, -50, opt['width'] + 50, opt['height'] + 50))
        self.region = opt['scrollregion']

        tk.Frame.__init__(self, master, relief=tk.SUNKEN, bd=2)
        self.create_menubar()
        self.master.config(menu=self.menubar)
        self.pack(fill=tk.BOTH, expand=True)
        self.canvas = XCanvas(self, **opt)
        self.canvas.pack(side=tk.LEFT, fill=tk.BOTH, expand=True)
Ejemplo n.º 2
0
    def __init__(self, master=None):
        Frame.__init__(self, master, relief=SUNKEN, bd=2)

        self.create_menubar()
        self.master.config(menu=self.menubar)
        self.pack(side=TOP, fill=BOTH, expand=True)

        panwin = PanedWindow(self,
                             orient=VERTICAL,
                             sashwidth=5,
                             bd=0,
                             bg='gray80',
                             opaqueresize=0)
        self.canvas = XCanvas(self.master,
                              bg="white",
                              width=1200,
                              height=640,
                              x_axis=11,
                              scalewidget=False,
                              bd=0,
                              highlightthickness=0)
        self.tkcon = TkConsole(self.master,
                               height=12,
                               width=90,
                               background='ivory')
        self.status = StatusBar(self.master)
        self.canvas.pack(side=tk.TOP, fill=tk.BOTH, expand=True)
        self.tkcon.pack(side=tk.TOP, fill=tk.BOTH, expand=True)
        self.status.pack(side=BOTTOM, fill=X, expand=False)

        self.tkcon.focus_set()

        # Put here all initializations you want to have in console
        # However it's better to use an initialization file for tkcon (look at tkcon.py)
        self.tkcon.eval('import os')
        self.tkcon.eval('import sys')
        self.tkcon.eval('from basics import *')
        self.status.set("%-60s %-16s %-16s",
                        "Status line for this eda app (60 chars)",
                        "Part2 (16c)", "Part3 (16c)")
Ejemplo n.º 3
0
    def __init__(self, master=None):
        tk.Frame.__init__(self, master, relief=tk.SUNKEN, bd=2)

        self.menubar = tk.Menu(self)

        menu = tk.Menu(self.menubar, tearoff=0)
        self.menubar.add_cascade(label="File", menu=menu)
        menu.add_command(label="New", command=self.new_)
        menu.add_command(label="Open", command=self.open)
        menu.add_command(label="Exit", command=self.exit)

        menu = tk.Menu(self.menubar, tearoff=0)
        self.menubar.add_cascade(label="Edit", menu=menu)
        menu.add_command(label="Cut", command=self.cut)
        menu.add_command(label="Copy", command=self.copy)
        menu.add_command(label="Paste", command=self.paste)
        menu.add_command(label="Clear ALL", command=self.clear)

        menu = tk.Menu(self.menubar, tearoff=0)
        self.menubar.add_cascade(label="Help", menu=menu)
        menu.add_command(label="About", command=self.about)
        menu.add_command(label="Help", command=self.help)

        self.master.config(menu=self.menubar)
        self.pack(side=tk.TOP, fill=tk.BOTH, expand=True)

        self.canvas = XCanvas(self,
                              scrollbars=False,
                              scalewidget=False,
                              x_axis=0,
                              y_axis=0,
                              width=900,
                              height=500,
                              bg="cornsilk")
        self.canvas.pack(side=tk.TOP, fill=tk.BOTH, expand=True)

        self.tkcon = TkConsole(self, height=12)
        self.tkcon.pack(side=tk.TOP, fill=tk.BOTH, expand=True)
        self.tkcon.focus_set()
Ejemplo n.º 4
0
class EdaCanvas(tk.Frame):
    def __init__(self, master=None, **opt):
        opt.setdefault('width', 800)
        opt.setdefault('height', 600)
        opt.setdefault('bg', 'white')
        opt.setdefault('bd', 0)
        opt.setdefault('highlightthickness', 0)
        opt.setdefault('scrollregion',
                       (-50, -50, opt['width'] + 50, opt['height'] + 50))
        self.region = opt['scrollregion']

        tk.Frame.__init__(self, master, relief=tk.SUNKEN, bd=2)
        self.create_menubar()
        self.master.config(menu=self.menubar)
        self.pack(fill=tk.BOTH, expand=True)
        self.canvas = XCanvas(self, **opt)
        self.canvas.pack(side=tk.LEFT, fill=tk.BOTH, expand=True)

    def create_menubar(self):
        self.menubar = tk.Menu(self)

        #----- File Menu -----
        menu = tk.Menu(self.menubar, tearoff=0)
        self.menubar.add_cascade(label="File", menu=menu)
        menu.add_command(label="New", command=self.new)
        menu.add_command(label="Open", command=self.open)
        menu.add_command(label="Exit", command=self.exit)

        #----- Edit Menu -----
        menu = tk.Menu(self.menubar, tearoff=0)
        self.menubar.add_cascade(label="Edit", menu=menu)
        menu.add_command(label="Cut", command=self.cut)
        menu.add_command(label="Copy", command=self.copy)
        menu.add_command(label="Paste", command=self.paste)
        menu.add_command(label="Clear ALL", command=self.clear)

        #----- Help Menu -----
        menu = tk.Menu(self.menubar, tearoff=0)
        self.menubar.add_cascade(label="Help", menu=menu)
        menu.add_command(label="About", command=self.about)
        menu.add_command(label="Help", command=self.help)

    def new(self):
        messagebox.showwarning("Not implemented",
                               "The 'new' method is not implemented yet")

    def open(self):
        messagebox.showwarning("Not implemented",
                               "The 'open' method is not implemented yet")

    def exit(self):
        answer = messagebox.askyesno("Exit?", "Are you sure you want to exit?")
        if answer:
            sys.exit(0)

    def clear(self):
        self.canvas.delete('item')

    def cut(self):
        messagebox.showwarning("Not implemented",
                               "The 'cut' method is not implemented yet")

    def copy(self):
        messagebox.showwarning("Not implemented",
                               "The 'copy' method is not implemented yet")

    def paste(self):
        messagebox.showwarning("Not implemented",
                               "The 'paste' method is not implemented yet")

    def help(self):
        try:
            self.help_top.destroy()
        except:
            pass
        self.help_top = tk.Tk()
        self.help_top.wm_title('HELP WINDOW')
        t = tk.Text(self.help_top,
                    font='Consolas 10 bold',
                    width=80,
                    height=24,
                    background='cornsilk',
                    foreground='blue')
        t.insert(
            tk.END,
            "Edit the help method:\nRead some help file and insert it here")
        t.pack(fill=tk.BOTH, expand=True)

    def about(self):
        messagebox.showinfo(
            "About EDA Application",
            "Engineering Design Project\nEEE Depatment\nPublic Education College"
        )
Ejemplo n.º 5
0
class TkApp(tk.Frame):
    def __init__(self, master=None):
        tk.Frame.__init__(self, master, relief=tk.SUNKEN, bd=2)

        self.menubar = tk.Menu(self)

        menu = tk.Menu(self.menubar, tearoff=0)
        self.menubar.add_cascade(label="File", menu=menu)
        menu.add_command(label="New", command=self.new_)
        menu.add_command(label="Open", command=self.open)
        menu.add_command(label="Exit", command=self.exit)

        menu = tk.Menu(self.menubar, tearoff=0)
        self.menubar.add_cascade(label="Edit", menu=menu)
        menu.add_command(label="Cut", command=self.cut)
        menu.add_command(label="Copy", command=self.copy)
        menu.add_command(label="Paste", command=self.paste)
        menu.add_command(label="Clear ALL", command=self.clear)

        menu = tk.Menu(self.menubar, tearoff=0)
        self.menubar.add_cascade(label="Help", menu=menu)
        menu.add_command(label="About", command=self.about)
        menu.add_command(label="Help", command=self.help)

        self.master.config(menu=self.menubar)
        self.pack(side=tk.TOP, fill=tk.BOTH, expand=True)

        self.canvas = XCanvas(self,
                              scrollbars=False,
                              scalewidget=False,
                              x_axis=0,
                              y_axis=0,
                              width=900,
                              height=500,
                              bg="cornsilk")
        self.canvas.pack(side=tk.TOP, fill=tk.BOTH, expand=True)

        self.tkcon = TkConsole(self, height=12)
        self.tkcon.pack(side=tk.TOP, fill=tk.BOTH, expand=True)
        self.tkcon.focus_set()

    def new_(self):
        messagebox.showwarning("Not implemented",
                               "The 'new' method is not implemented yet")

    def open(self):
        messagebox.showwarning("Not implemented",
                               "The 'open' method is not implemented yet")

    def exit(self):
        answer = messagebox.askyesno("Exit?", "Are you sure you want to exit?")
        if answer:
            self.master.destroy()

    def clear(self):
        self.text.delete(1.0, tk.END)

    def cut(self):
        messagebox.showwarning("Not implemented",
                               "The 'cut' method is not implemented yet")

    def copy(self):
        messagebox.showwarning("Not implemented",
                               "The 'copy' method is not implemented yet")

    def paste(self):
        messagebox.showwarning("Not implemented",
                               "The 'paste' method is not implemented yet")

    def help(self):
        try:
            self.help_top.destroy()
        except:
            pass
        self.help_top = tk.Tk()
        self.help_top.wm_title('HELP WINDOW')
        t = tk.Text(self.help_top,
                    font='Consolas 10 bold',
                    width=80,
                    height=24,
                    background='cornsilk',
                    foreground='blue')
        t.insert(
            tk.END,
            "Edit the help method:\nRead some help file and insert it here")
        t.pack(fill=tk.BOTH, expand=True)

    def about(self):
        messagebox.showinfo(
            "About EDA Application",
            "Engineering Design Project\nEEE Depatment\nFlinstone College")
Ejemplo n.º 6
0
class EdaApp(Frame):
    def __init__(self, master=None):
        Frame.__init__(self, master, relief=SUNKEN, bd=2)

        self.create_menubar()
        self.master.config(menu=self.menubar)
        self.pack(side=TOP, fill=BOTH, expand=True)

        panwin = PanedWindow(self,
                             orient=VERTICAL,
                             sashwidth=5,
                             bd=0,
                             bg='gray80',
                             opaqueresize=0)
        self.canvas = XCanvas(self.master,
                              bg="white",
                              width=1200,
                              height=640,
                              x_axis=11,
                              scalewidget=False,
                              bd=0,
                              highlightthickness=0)
        self.tkcon = TkConsole(self.master,
                               height=12,
                               width=90,
                               background='ivory')
        self.status = StatusBar(self.master)
        self.canvas.pack(side=tk.TOP, fill=tk.BOTH, expand=True)
        self.tkcon.pack(side=tk.TOP, fill=tk.BOTH, expand=True)
        self.status.pack(side=BOTTOM, fill=X, expand=False)

        self.tkcon.focus_set()

        # Put here all initializations you want to have in console
        # However it's better to use an initialization file for tkcon (look at tkcon.py)
        self.tkcon.eval('import os')
        self.tkcon.eval('import sys')
        self.tkcon.eval('from basics import *')
        self.status.set("%-60s %-16s %-16s",
                        "Status line for this eda app (60 chars)",
                        "Part2 (16c)", "Part3 (16c)")

    def create_menubar(self):
        self.menubar = tk.Menu(self)

        # File menu
        menu = tk.Menu(self.menubar, tearoff=0)
        self.menubar.add_cascade(label="File", menu=menu)
        menu.add_command(label="New", command=self.new)
        menu.add_command(label="Open", command=self.open)
        menu.add_command(label="Exit", command=self.exit)

        # Edit menu
        menu = tk.Menu(self.menubar, tearoff=0)
        self.menubar.add_cascade(label="Edit", menu=menu)
        menu.add_command(label="Cut", command=self.cut)
        menu.add_command(label="Copy", command=self.copy)
        menu.add_command(label="Paste", command=self.paste)
        menu.add_command(label="Clear ALL", command=self.clear)

        # Help menu
        menu = tk.Menu(self.menubar, tearoff=0)
        self.menubar.add_cascade(label="Help", menu=menu)
        menu.add_command(label="About", command=self.about)
        menu.add_command(label="Help", command=self.help)

    def debug(self, event):
        #print(event.keysym)
        #print(self.panwin.cget('sashwidth'))
        #self.panwin.config(sashwidth=6)
        #print(self.winfo_geometry())
        #self.panwin.paneconfigure(self.tkcon, minsize=100)
        pass

    def new(self):
        messagebox.showwarning("Not implemented",
                               "The 'new' method is not implemented yet")

    def open(self):
        messagebox.showwarning("Not implemented",
                               "The 'open' method is not implemented yet")

    def exit(self):
        answer = messagebox.askyesno("Exit?", "Are you sure you want to exit?")
        if answer:
            sys.exit(0)

    def clear(self):
        self.tkcon.clear()

    def cut(self):
        messagebox.showwarning("Not implemented",
                               "The 'cut' method is not implemented yet")

    def copy(self):
        messagebox.showwarning("Not implemented",
                               "The 'copy' method is not implemented yet")

    def paste(self):
        messagebox.showwarning("Not implemented",
                               "The 'paste' method is not implemented yet")

    def help(self):
        try:
            self.help_top.destroy()
        except:
            pass
        self.help_top = tk.Tk()
        self.help_top.wm_title('HELP WINDOW')
        t = tk.Text(self.help_top,
                    font=('Consolas', 10, 'bold'),
                    width=80,
                    height=24,
                    background='cornsilk',
                    foreground='blue')
        t.insert(
            END,
            "Edit the help method:\nRead some help file and insert it here")
        t.pack(fill=BOTH, expand=True)

    def about(self):
        messagebox.showinfo(
            "About EDA Application",
            "Engineering Design Project\nEEE Depatment\nPublic Education College"
        )