from p_gdxf import ThanDxfPlot
class Tk(ThanDxfPlot):
def __init__(self):
ThanDxfPlot.__init__(self)
self.thanDxfPlots()
def mainloop(self):
self.thanDxfPlot(0.0, 0.0, 999)
def title(self, tit):
self.thanDxfPlotSymbol(20.0, self.height-(-20.0), 15, tit, 0.0)
def columnconfigure(self, *args, **kw): pass
def rowconfigure(self, *args, **kw): pass
class Canvas:
def __init__(self, master, background, width=19.0, height=29.0):
self.width = master.width = width
self.height = master.height = height
self.dxf = master
mastercanvas = self
self.textsize = 7
self.texttheta = 0.0
def bind(self, *args, **kw): pass
def grid(self, *args, **kw): pass
def update(self, *args, **kw): pass
def delete(self, *args, **kw): pass
def winfo_width(self): return self.width
def winfo_height(self): return self.height
def create_line(self, xy, fill="white", width=1):
if len(xy) < 2: return
self.dxf.thanDxfSetColor(tk2dxfCol.get(fill, 7))
ipen = 3
for x,y in xy:
self.dxf.thanDxfPlot(x, self.height-y, ipen)
ipen = 2
def create_text(self, x, y, fill="white", text=""):
text = str(text).strip()
if len(text) == 0: return
self.dxf.thanDxfSetColor(tk2dxfCol.get(fill, 7))
self.dxf.thanDxfPlotSymbol(x, self.height-y, self.textsize, text, self.texttheta)
def create_rectangle(self, x1, y1, x2, y2, fill=None, outline="white"):
if fill != None:
self.dxf.thanDxfSetColor(tk2dxfCol.get(fill, 7))
self.dxf.thanDxfPlotSolid4(x1, self.height-y1,
x2, self.height-y1,
x2, self.height-y2,
x1, self.height-y2)
self.dxf.thanDxfSetColor(tk2dxfCol.get(outline, 7))
self.dxf.thanDxfPlot(x1, self.height-y1, 3)
self.dxf.thanDxfPlot(x2, self.height-y1, 2)
self.dxf.thanDxfPlot(x2, self.height-y2, 2)
self.dxf.thanDxfPlot(x1, self.height-y2, 2)
self.dxf.thanDxfPlot(x1, self.height-y1, 2)
def create_polygon(self, *args, **kw): pass
def create_arc(self, *args, **kw): pass
tk2dxfCol = \
{ "red" : 1,
"yellow" : 2,
"green" : 3,
"cyan" : 4,
"blue" : 5,
"magenta": 6,
"white" : 7,
"orange" : 30,
"pink" : 241
}
ALL = "ALL"
|