What's with canvas in Pythonista 3.
zencuke last edited by
@omz Works for me. ;-) The nice thing about Pythonista is that I have so many choices. Thanks for that.
JonB last edited by
turtle.py is (undocumented as far as i can tell) included in pythonista, at least as far back as 1.5
omz last edited by
@JonB Not quite. I actually built a version of the
turtlemodule specifically for Pythonista 3, just a few months ago, and it is only available in Python 3 mode at the moment... The standard library
turtlemodule is built on top of
Tkinter, so I basically had to re-implement it from scratch, using
ui-based drawing. What I've got so far is included in Pythonista 3, but a few things are missing, and I haven't documented it (or mentioned it in the release notes) because I'm not completely sure if I want to continue with this approach.
berndmeyer last edited by ccc
Hello, I wanted to check whether the old canvas library had ever been fixed or whether it is now terminally deprecated. Just found out last night that all my old graphics examples don't work anymore (neither in Pythonista 2 nor in 3) and reduced it to this crashing. After some iterations (aproximately 20 out loops) there is no further output and after s hort while a full abort of Pythonista follows.
# coding: utf-8 import canvas import colorsys from six.moves import range #this crashes Pythonista 2 and 3. canvas depracated? w=h=512 canvas.set_size(w,h) def plot(): canvas.clear() for x in range(1,512,2): for y in range(1,512,2): canvas.set_fill_color(.75,.25,.25) canvas.fill_ellipse(x,y,1,1)
JonB last edited by
I think you might find this will make your code work, at least it did for me:
Unless you are trying to see the individual dots appear one at a time...
berndmeyer last edited by
thanks for the hint.
Yes, wrapping everything in begin_update/end_update works for me as well.
Unfortunately, I was actually trying to make the "live update" visible, i.e. seeing every dot appear.
If that's not required it's straight forward to use the UI module instead, but live updates are actually relatively complex to do in there. I use this for educational purposes, so having a lot of (object oriented) code around this is quite counter-productive.
If I wrap every fill_ellipse call into begin_update/end_update (just for fun) i get exactly the same effect as without wrapping. Seems canvas doesn't like to be overloaded with update requests.
robopu last edited by
@omz Thank you. That will be helpful. I experimented with several gestures but didn't hit on that one. I kept trying to pull it down by grabbing the top edge. Are the supported gestures documented anywhere? There are a few documented in the "Using Pythonista" section. I sometimes have this paranoid feeling that everyone else gets much more from Pythonista because they know all these cool features I never heard of. I need a 4 year old to beat on my iPhone. They try everything and seem to find new gestures faster than anyone else.
BTW: I haven't told you this lately but Pythonista is the absolutely the coolest app I have ever seen. I tell everyone who will listen how great it is. My next project is to sell my kids on it who are both learning python in other contexts. And the best part is you keep adding cool new features. I was glad that I was finally able to give you a little money by getting Pythonista 3. I would have happily paid ten times that amount.
zencuke i've been playing around with python a bit the last few months on mac. i've been programming for years. i'm new to pythonista. on the surface it would seem to me that it is basically just the same standard python but on an iOS device with perhaps some interfaces to some of the other apps / services on the device. not that this isn't cool. it is but because i'm new here and your enthusiasm is so high, i'm wondering if you might be more explicit and say specifically what is that is cool so i can personally see the light much quicker vs other contexts i'm currently using and cut to the chase to some functionality i'm probably easily overlooking? :)
btw, i don't see a pythonista app for the mac in Apps. so my guess is this is only an iOS thing right?
ccc last edited by ccc
Pythonista is iOS only. The feature are described at http://omz-software.com/pythonista/ and http://omz-software.com/pythonista/docs/ios/ The modules like ui, scene, and canvas allow you to build iOS apps in Python. The inclusion of NumPy, Matplotlib, Requests, BeautifulSoup, Flask, Jinja2, Pillow, etc. are also quite powerful.
fildena last edited by
It's possible that the issue you're experiencing with the canvas not displaying in Pythonista 3 could be related to changes or updates in the Pythonista environment. However, without more specific information about your code and environment, it's challenging to pinpoint the exact cause.
Here are a few troubleshooting steps you can take:
Check the Code: Make sure the code you're running is correct and compatible with Pythonista 3. Some differences in the Python 2 and Python 3 syntax can affect graphics rendering.
Update Pythonista: Ensure that you are using the latest version of Pythonista, as updates may include bug fixes and improvements. Check the App Store for any available updates.
Check for Python 3 Compatibility: If the code is written for Python 2, it may need some modifications to work correctly in Pythonista 3, which uses Python 3. Make sure any print statements, division, and other syntax differences are addressed.
Canvas Settings: Review any canvas settings and ensure that you're specifying the canvas size and parameters correctly.
Community Forums: Check the Pythonista community forums or contact their support for specific help related to Pythonista 3, as other users may have encountered and resolved similar issues.
If you've verified these points and are still experiencing issues, it might be worthwhile to reach out to the Pythonista support community or directly to the Pythonista developers for assistance with this specific problem, as they can provide more in-depth troubleshooting and guidance.