Giter Club home page Giter Club logo

mobilechelonian's Introduction

"Nevertheless... the turtle moves!" - Small Gods, by Terry Pratchett

This is a Turtle module for the Jupyter Notebook. It's based on code by aspidites, one of two groups at Macewan University that built Turtle as a class assignment (the other was PACattack; I could have based this on either, but I had to pick one).

Install it in a terminal/command prompt with:

pip install mobilechelonian

Using it looks like this:

from mobilechelonian import Turtle
t = Turtle()
t.speed(5)
colours=["red","blue","yellow","brown","black","purple","green"]

t.penup(); t.left(90); t.forward(200);t.right(90);t.pendown()
for i in range (0,18):
    t.pencolor(colours[i%7])
    t.right(20)
    t.forward(50)

t.right(180)
t.home()

image

image

mobilechelonian's People

Contributors

choldgraf avatar das-g avatar franciscomoya avatar hoogenm avatar jablka avatar takluyver avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

mobilechelonian's Issues

Working with Screen objects

In standard turtle, you can setup a turtle screen so that you can control its size and position:

Normally, I would do this as:

from turtle import Turtle, Screen
screen = Screen()
screen.setup(width=600, height=600, startx=600, starty=300)

Is there a way to do something similar in mobilechelonian? I need to set the screen width & height in the notebook output cell.

New version for this extension

Hi guys,

I forked your repository for the purpose of an internship to correct some errors and personalize it for teaching at the IUT de villetaneuse.
So I created a new extension from yours (here is the link). That extension was made as part of a 3-month internship at the iut of villetaneuse under the supervision of M. Lacroix.
I did a complete rewrite of some files and organized in a clean way.

Test it on binder
Binder

So I observed a strange effect when the turtle near the edge of the drawing area and bugs on the turtle speed display, sometimes the lines are not drawn and other issues.

Here are some bugs fixed

# This code does not draw a perfect square due to limitations
from mobilechelonian import Turtle
t = Turtle()
t.speed(5)
for i in range(4):
    t.right(90)
    t.forward(300)

image1

# This code does not draw the line
# because the speed is greater than the added variation
t = Turtle()
t.speed(5)
for i in range(10):
    t.forward(5)
t.penup()
t.forward(100)

image2

Greetings
Abdou KANDJI

Floating Display Widget

At the moment, the display canvas seems to be anchored as the output of the code cell that creates it.

It would be useful if the canvas could float / be dragged around the notebook so that as a script is built up over several cells, each step can be inspected in turn without having to try to scroll back to the display canvas to see what's happening.

There is an example of a floating canvas in this (old) notebook turtle repo: https://github.com/gkvoelkl/ipython-turtle-widget

The turtle doesn't seem to be able to round...

If you give it a left or right command that has lots of decimals, then the turtle performs this action, but hangs and will not respond to commands afterwards.

In my case, I can recreate this by:

won't work

t.right(40.435435)
t.forward(60)

will work

t.right(np.round(40.435435))
t.forward(60)

Messed up angles

Hi guys,

I observed another strange effect, when moving the turtle to close to the edge of the drawing area.
This code example stays away from the borders and looks like I would expect:

image

If I use the same code - but now extend the line length to hit the edge, funny things occur:

image

As you can see, not only the starting angles of the lines are messed up. They should have almost the same degree between them - which they do not have. Also the 90 degree turn at the end of the first line is far away from being 90 degrees consistently.

This makes it completely unpredictable, how a drawing will look, when you come close to the border even once during the drawing process.

Any suggestions?

Regards
Pascal

Add more supported functions

I found this module extremely useful for online teaching using Jupyter notebook. However, there are a lot fo turtle functions not supported. It would be great if add more functions to this package. In particular, position(), setx(), sety(),

The current version in pypi (0.4) isn't compatible with ipywidgets 7.x

Is it possible to have version 0.5 added to PyPI? Or a note added to the README reminding people to try installing from the current master branch if they are running ipywidgets 7. f90afaa on the master branch identifies as 0.5 and installs fine with

git clone https://github.com/takluyver/mobilechelonian.git
cd mobilechelonian
pip install .

PyPI only has version 0.4, which spits out some javascript errors about missing files.

Supporting jupyterlab?

I'm curious if anyone has gotten this to work using JupyterLab rather than e.g. jupyter notebooks.

I'm installing it using

cd /opt && \
git clone https://github.com/dirkcgrunwald/mobilechelonian.git && \
cd mobilechelonian && \
python setup.py install

in my setup (docker / zero2jupyterlab setup).

When running the example I get "Error creating widget: could not find model" which appears to mean I haven't done a "jupyter labextension install" -- but even if I do that, doesn't work.

Not certain what Fine Manual to read to offer a patch since i haven't authored ipywidgets or jupyterlab widgets before.

turtle strokeWidth seems too large

mobilechelolianjs sets a default stroke width of 3 units. This is way larger than the default width in the stock Python turtle module.

Besides there is a typo in turtlewidget.js which fails to set the default strokeWidth because of wrong capitalization unless you invoke penup/pendown (I already submitted a pull request to fix this).

Since pensize is still missing I would suggest to reduce the default pen size to 1.

Regards,

Doesnot output in jupyter

Hello, maybe I am too new to python. It doesnot do anything in jupyter. When I run the example with

from turtle import Turtle

from my python3 installation, it is ok. If I use the same in Jupyter ... TclError: no display name and no $DISPLAY environment variable

With from mobilechelonian import Turtle it is just silent. On print(t) it says
<mobilechelonian.Turtle object at 0x7fa0dc3eaf60>, so something happens. Some %inline directive is missing maybe? Thank you.

Cornered turtle

Hi guys,

I observed a problem with the title in the corner.
Moving the turtle closer and closer to the wall results in unpredictable movements.
In the following example I expected three parallel lines - but the closer I move the turtle towards the edge of the drawing board, the higher an angle of error I receive.

image

What makes it even strange - and even more unpredictable - is the fact, that these unexpected angles CHANGE, when I change the length of the forward move. In the next example I reduced the forward-movement to 20 steps - an receive a 45 degree error in the drawing of the line starting at (0,0).

image

Any ideas on this?
Can you solve this - or explain, what should be done in order to circumvent this problem?

Regards
Pascal

t.backward() going down instead of moving back

I think there is a bug in the code of the method backward(). The turtle goes down, instead of moving back.

from mobilechelonian import Turtle
t = Turtle()
t.speed(5)

t.forward(100)
t.backward(100) 

image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.