Package: pyfractal
pyfractalA simple gui based self-similar fractal generatorIntroductionThis project is aimed to provide a simple gui for drawing fractals so that anyone enthusiastic enough can give them a try.Table of contentsFeaturesSetupUsageLibraries UsedFeedbackTODOSourcesContactI was exploringan awesome sitewhich taught me how aturtlewould draw amazing fractal curves.
Perhaps I made a small script which would draw fractals pretty neatly but it had two issues :-It was slowas it took sleeps in between each step (huh is it a turtle or a rabbit) and even after turning the animations off, it was still slow due to implementation stylesPython Turtle's audience is beginners to programming, so it limited the extendibility of the scriptI wanted to learn more about GUI programming, python packaging, good coding practices andother important stuffIt hadlimited scopein scrolling, panning and zooming (the most fun things to do with a fractal)There is no pyfractal python library heheFeaturesA GUI (obviously)Exporting fractals to your desired format (namely svg, postscript and png)Loading and storing curve parameters for future endeavoursScrolling, panning and zooming to any extentPreview of base shape of fractalDrawing multiple fractals at once on a canvasAppending rules of several fractals (more people may consider it a bug, but i consider it a feature)Degree and radian supportSetuppip3 install pyfractalorpip install pyfractalshould do the job depending on the distributionHaving issues installing? Feel free toreport issueor simply clone the repository and runmain.pyUsageimport pyfractal  #import the module
pyfractal.GUI().run()  #to run the main guiA GUI should pop upCurve parameter inputPressing on theplusandminusbuttons adds and removes entires for rule inputSaving curve parametersPress theSave Parametersbutton to save the parameters, a dialog box should appear asking for the name of the file to save
the parameters are stored in a json fileLoading curve parametersPress theLoad Parametersbutton to load the parameters, a dialog box should appear asking for the name of the file. If the file is correctly formatted, you should see the parameters loaded onto the screen and list of rules added to the list.NOTEThe rules are appended to the list of pre-written rules (this is a design choice, not a bug) , clear the pre-existing rules by repeatedly pressingminusbutton then loading from file.Drawing fractalsFeed in/ load the rules, you will see the preview of base fractal image on the smaller canvas.Enter your desiredRecursion Depthand you will see your fractal drawn on the canvas
Pan/scale/scroll in the canvas according to your viewing preferencesNOTEThe rules/preview-canvas is update only onceplusorminusbutton is pressed.Start drawing fractal from a smaller recursion-depth. The size of fractal is exponential in the recursion depth. It is recommended that you keepRecursion depthto a single digit integer.Libraries UsedThe project is almost built entirely ontkinterBesides usingPillowandcanvasvgto save the canvasFeedbackFeel free to contribute/clone/IssueorContactmeTODOThis is probably a VERY long list but here are key TODO's :-Curved EdgesAdding option to curve the corners/edges to make the fractal smoother and to see more clearly the sweep of the fractalAdding splines instead of boring straight linesConversion of degree to radians in input feild on pressing radio buttons (not really important but OK)Help PagesNo amount of help pages is sufficientMenubarAdding a Menubar for easy access to resources and help pagesMore graphic optionsColor support for lines and fillsBackground color/image specificationAnimationsAnimating the turtle (why?? wasn't this the main purpose behind building this project) to momentarily enjoy the chaos caused by simple rules of lifeMore types of fractalsSupport forL systemsSupport for GeneralIFSA more non-math peep friendly system?Grid based input
As describedhereSquare gridTriangular gridA general lattice maybe?A general 3 dimensional lattice (okay I admit I am being too optimistic)Fractal type specifierAutomatically specify self-avoiding, self-contacting(edge/vertex), self-crossing types from the base rulesDimension calculatorFractal tile extractionExtract tiles from tile-able fractalsMore tooooooolsClone fractalsDrag and drop items around on the canvasSourcesThe following links are pretty useful and helpful in learning more about fractalshttp://www.fractalcurves.comis the main inspiration behind this projecthttps://www.youtube.com/watch?v=gB9n2gHsHN4is a pretty interesting watch by 3Blue1BrownContactMy websiteFeel free to give suggestions/recommendations/criticism onDiscordorLinkedIn