dxfinter.py :  » Business-Application » ThanCad » thancad-0.0.9 » p_gtecqm » Python Open Source

Home
Python Open Source
1.3.1.2 Python
2.Ajax
3.Aspect Oriented
4.Blog
5.Build
6.Business Application
7.Chart Report
8.Content Management Systems
9.Cryptographic
10.Database
11.Development
12.Editor
13.Email
14.ERP
15.Game 2D 3D
16.GIS
17.GUI
18.IDE
19.Installer
20.IRC
21.Issue Tracker
22.Language Interface
23.Log
24.Math
25.Media Sound Audio
26.Mobile
27.Network
28.Parser
29.PDF
30.Project Management
31.RSS
32.Search
33.Security
34.Template Engines
35.Test
36.UML
37.USB Serial
38.Web Frameworks
39.Web Server
40.Web Services
41.Web Unit
42.Wiki
43.Windows
44.XML
Python Open Source » Business Application » ThanCad 
ThanCad » thancad 0.0.9 » p_gtecqm » dxfinter.py
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"
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.