Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed1a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'package,': 0.03; '(at': 0.04; 'repository': 0.05; 'root': 0.05; 'turtle': 0.07; 'welcome.': 0.07; '"__main__":': 0.09; '__name__': 0.09; 'main()': 0.09; 'os.path': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'shutil': 0.09; 'url:github': 0.09; 'windows,': 0.09; 'python': 0.11; 'def': 0.12; 'bug': 0.12; 'jan': 0.12; 'wrote': 0.14; '"r")': 0.16; '-------': 0.16; '__init__.py': 0.16; 'default)': 0.16; 'dirname': 0.16; 'entry:': 0.16; 'equations': 0.16; 'imports': 0.16; 'lambda': 0.16; 'main():': 0.16; 'none.': 0.16; 'optional': 0.16; 'prefixed': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'reedy': 0.16; 'tkinter.': 0.16; 'unnecessary.': 0.16; 'extensions': 0.16; 'wrote:': 0.18; 'app': 0.19; 'module': 0.19; 'trying': 0.19; 'file,': 0.19; 'small,': 0.19; 'examples': 0.20; 'seems': 0.21; 'example': 0.22; 'import': 0.22; 'load': 0.23; 'header:User-Agent:1': 0.23; 'directory.': 0.24; 'entries': 0.24; 'expanded': 0.24; 'package.': 0.24; 'regardless': 0.24; 'file.': 0.24; '(or': 0.24; 'skip:" 40': 0.26; 'least': 0.26; '(for': 0.26; 'header:X-Complaints-To:1': 0.27; 'header:In-Reply-To:1': 0.27; 'installed': 0.27; 'relative': 0.30; 'that.': 0.31; 'too.': 0.31; '3.x': 0.31; 'dialog': 0.31; 'work:': 0.31; 'allows': 0.31; 'file': 0.32; 'probably': 0.32; 'run': 0.32; 'open': 0.33; 'linux': 0.33; 'running': 0.33; '(most': 0.33; 'comment': 0.34; 'copying': 0.34; 'could': 0.34; 'but': 0.35; 'add': 0.35; 'version': 0.36; 'idle': 0.36; 'skip:j 20': 0.36; 'done': 0.36; 'hi,': 0.36; 'should': 0.36; 'reports': 0.37; 'skip:- 20': 0.37; 'to:addr:python-list': 0.38; 'files': 0.38; 'pm,': 0.38; 'rather': 0.38; 'recent': 0.39; 'ability': 0.39; 'does': 0.39; 'received:71': 0.39; 'to:addr:python.org': 0.39; 'either': 0.39; 'received:org': 0.40; 'remove': 0.60; 'read': 0.60; 'blank': 0.60; 'deleting': 0.60; 'save': 0.62; 'such': 0.63; 'within': 0.65; 'rendering': 0.68; 'home': 0.69; 'containing': 0.69; 'ending': 0.78; 'actually,': 0.84; 'directory:': 0.84; 'everything.': 0.84; 'received:fios.verizon.net': 0.84; 'subject:system': 0.84; 'subject:tool': 0.84; 'wither': 0.84; 'opens': 0.91; 'try.': 0.91 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Terry Reedy Subject: Re: L-system equations drawing tool Date: Fri, 18 Jul 2014 19:11:02 -0400 References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Gmane-NNTP-Posting-Host: pool-71-175-90-87.phlapa.fios.verizon.net User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 In-Reply-To: X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 101 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1405725104 news.xs4all.nl 2876 [2001:888:2000:d::a6]:58032 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:74783 On 7/17/2014 5:38 PM, Ya=C5=9Far Arabac=C4=B1 wrote: > Hi, > > I wrote a small program to draw L-system equations using tkinter. You > can find it on https://github.com/yasar11732/tklsystem > > It is still under development, but seems to be working nice so far. I > could only try it on windows, but it should work on Linux too. > > You will need Python 3.x to run it. PIL/Pillow is optional but highly > recommended. It allows faster rendering and ability to save images. > > You can also save your equations and load them later. > > Try it and comment it if you are interested. Bug reports and > contributions are also welcome. As near as I can tell, this is a collection of modules rather than a=20 package. This means that for imports like these to work: from l_system_utils import cached_expand_string from lsturtle import Turtle the containing directory must be added to the search path, as is done by = running from within the directory. That is ok for now and what I will try= =2E However, if your repository were a package, lsystem, with a blank=20 __init__.py and __main__.py containing from lsystem import main main.main() and main.py contained an expanded version of the current ending def main(): root =3D tk.Tk() app =3D Main(root) root.bind("", lambda _: app.render_image()) app.run() if __name__ =3D=3D "__main__": main() and the module names prefixed wither either 'lsystem/' or './' (for=20 relative imports) and the package were installed in lib/site-packages, it would then run=20 with pythonw -m lsystem (or pyw -3 -m lsystem, I believe) pip (at least by default) installs packages in site-packages. It will=20 also add a file to /scripts though I don't know the setup to do that. ----------------------- Copying the examples directory withing the non-package directory to my=20 home directory with this self.lsf_dir =3D expanduser(join("~", "lsf-files")) if not isdir(self.lsf_dir): from shutil import copytree from os.path import dirname examples =3D join(dirname(__file__), "examples") copytree(examples, self.lsf_dir) means that deleting the directory will not remove everything. Not nice.=20 Also unnecessary. Regardless of where you save, read them from the=20 original directory. Actually, the files are so small, that you could instead make them=20 entries in one examples.cfg file, much like Idle does with extensions=20 (for instance) using configparser.ConfigParser. You could then save to=20 a single user.cfg file. Example entry: [dragon curve] iterations=3D 12 angle=3D 90 axiom=3D FX rule1=3D X:X+YF+ rule2=3D Y:-FX-Y rule3=3D rule4=3D constants=3D ------- If I hit 'load', the file dialog opens in idlelib. If I hit [cancel], I get an error, probably from trying to open None. Traceback (most recent call last): File "C:\Programs\Python34\lib\tkinter\__init__.py", line 1487, in=20 __call__ return self.func(*args) File "main.pyw", line 248, in load_from_file with open(fname, "r") as f: FileNotFoundError: [Errno 2] No such file or directory: '' --=20 Terry Jan Reedy