42 lines
732 B
Python
Executable File
42 lines
732 B
Python
Executable File
from Plotter import *
|
|
from Command import *
|
|
from Program import *
|
|
import Tkinter as tk
|
|
|
|
|
|
def show(p):
|
|
win=tk.Tk()
|
|
win.title('HPGLPLOTTER')
|
|
plt=Plotter((10,10,590,590))
|
|
canvas=tk.Canvas(win,width=600,height=600)
|
|
canvas.grid(row=0,column=0)
|
|
x = y = 0
|
|
p=p.flip()
|
|
p=plt.full(p)
|
|
p=plt.centralize(p)
|
|
for command in p.commands:
|
|
if command.name == 'PU':
|
|
x,y = command.x,command.y
|
|
elif command.name=='PD':
|
|
canvas.create_line(x,y,command.x,command.y)
|
|
x,y = command.x,command.y
|
|
elif command.name == 'CI':
|
|
r=command.args[0]
|
|
canvas.create_oval(x-r,y-r,x+r,y+r)
|
|
win.mainloop()
|
|
|
|
plt=Plotter()
|
|
p=Program()
|
|
p.parsefile('hpgl/Lars.plt')
|
|
p=p.flip()
|
|
p=plt.full(p)
|
|
p=plt.centralize(p)
|
|
plt.write(p)
|
|
|
|
#show(p)
|
|
p=p+10
|
|
|
|
|
|
|
|
|