This Youtuber:
Morphocular
says, he has made his math animations with this library-package:
https://github.com/morpho-matters/morpholib
So i decided to play around with it my self.
I installed python, the package and the pycharm environment and tested some sample codes from the repository.
But the window, that opened from running theese things, flickered in green horizontal stripes and the lines look a bit out of shape
How to fix this?
I played around with the turtle library before, but do not mention it in my code any more
Than i tried to create a polygon my self with this code:
like this
Made with Geogebra
If i run the code, as it is, i get this error:
Does any one know how to use this morpho package, how to enter the vertex-coordinates for the polygon the right way and centrate the coodinate-origin on the window?
Morphocular
says, he has made his math animations with this library-package:
https://github.com/morpho-matters/morpholib
So i decided to play around with it my self.
I installed python, the package and the pycharm environment and tested some sample codes from the repository.
But the window, that opened from running theese things, flickered in green horizontal stripes and the lines look a bit out of shape
How to fix this?
I played around with the turtle library before, but do not mention it in my code any more
Than i tried to create a polygon my self with this code:
import morpholib as morpho morpho.importAll() from morpholib.tools.basics import * from morpholib.video import * from morpholib.grid import Polygon import math, cmath, random def kite(): class Kite(morpho.Skit): def makeFrame(self): kitepolygon = morpho.grid.Polygon(vertices = [(0, 1), (2, 0), (0, -3), (-2, 0)]) kitepolygon.width = 4 kitepolygon.color = (1,1,0) kitepolygon.alphaEdge = 0 kitepolygon.fill = (1,1,0) kitepolygon.alphaFill = 0 kitepolygon.alpha = 0 kitepolygon.commitTransforms() return morpho.Frame([kitepolygon]) kite1 = Kite() kite1 = morpho.Actor(kite1) kite1.newendkey(6*30).t = 6 animation = morpho.Animation(kite1) animation.play() kite()The coordinates should create a kite with the siagonals intersecting in the coordinate origin.
like this
Made with Geogebra
If i run the code, as it is, i get this error:
Error: File "C:\Users\"User-Name"\AppData\Roaming\Python\Python311\site-packages\morpholib\grid.py", line 2740, in <lambda>
newVertices = self.fimage(lambda s: (mat*(rot*s))+self.origin).vertices
~~~^~
TypeError: can't multiply sequence by non-int of type 'complex'
If i comment out the line "kitepolygon.commitTransforms()", i get an empty window.Does any one know how to use this morpho package, how to enter the vertex-coordinates for the polygon the right way and centrate the coodinate-origin on the window?
Larz60+ write Nov-13-2022, 01:35 AM:
Please post all code, output and errors (it it's entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.
Fixed your code this time, please use BBCode tags on future posts.
Please post all code, output and errors (it it's entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.
Fixed your code this time, please use BBCode tags on future posts.