All pastes #490652 Raw Edit

Anonymous

public text v1 · immutable
·published 2007-05-16 04:18 UTC
rendered paste body
import Tkinter as Tk
from vapt.vapt_plugin import VaptPlugin

class Pt_iterate(Tk.Toplevel):

    def __init__(self, master,plug):
        self.plug = plug
        Tk.Toplevel.__init__(self, master)
        self.transient(master)
        self.title("Points")
        self.x_label=Tk.Label(self, text="X coord location").pack()     
        self.x_num=Tk.Entry(self)
        self.x_num.pack()
        self.y_label=Tk.Label(self, text="Y coord location").pack()     
        self.y_num=Tk.Entry(self)
        self.y_num.pack()
        Tk.Button(self, text="Write", command=self.on_button).pack() 
        Tk.Button(self, text="Cancel", command=self.cancel_button).pack() 

    def on_button(self):
        plug = self.plug
        editor = plug.raise_apt()
        x=self.x_num.get()
        y=self.y_num.get()
        sym1 = plug.get_apt_symbol('p')
        editor.insert(Tk.INSERT, sym1)
        editor.insert(Tk.INSERT,'= point/')
        editor.insert(Tk.INSERT, x)
        editor.insert(Tk.INSERT, ',')
        editor.insert(Tk.INSERT, y)
        editor.insert(Tk.INSERT,'\n')

    def cancel_button(self):
	self.destroy()

class Point_Iterator_Plugin(VaptPlugin):
    def __init__(self, mainframe):
        # must call the base class
        VaptPlugin.__init__(self, mainframe)
        # This will be the string show in the vapt Plugin menu.
        self.menu_name = 'Points'
        # anything else here

    def run(self):
        """This will be called when the menu is clicked.
        """
        Pt_iterate(self.mf, self) 

    def unload(self):
        """This is called just before vapt shuts down.
        You dont have to implement this if you dont need it.
        VaptPlugin.unload() will be called, which does nothing.
        """
        # anything else here
        pass