Python Projects

Teaching software development? Using LiveCode to build your curriculum? This is the forum for you.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9354
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Python Projects

Post by richmond62 » Thu Nov 04, 2021 9:45 am


richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9354
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Python Projects

Post by richmond62 » Thu Nov 04, 2021 10:25 am

Turtle Power_1.png
-
Turtle Power_2.png
-
The 'snag' from the point of view of LiveCode is that is does not come with
a built-in 'Turtle', so we have to supply our pupils with a stack that offers this:

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9354
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Python Projects

Post by richmond62 » Thu Nov 04, 2021 10:45 am

Many people love Python because it is easy to read (at least compared to some other programming languages). Being able to read code is a very important skill, just as important as writing it.
Is that a fact?

I would argue that LiveCode is considerably easier.
-
SShot 2021-11-04 at 11.49.13.png
-
SShot 2021-11-04 at 11.50.50.png
SShot 2021-11-04 at 11.50.50.png (16.3 KiB) Viewed 13271 times

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9354
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Python Projects

Post by richmond62 » Thu Nov 04, 2021 10:53 am

SShot 2021-11-04 at 11.52.01.png
-
I suppose after 20 years of RunRev/LiveCode I have been so "contaminated"
I find that far from welcoming, and it reminds me of my 1981 BBC Model B.
When IDLE starts you will see an Output window called Python Shell. We need to open a new window to write code in. Go to File -> New Window so you’re ready for Step 1. Make sure you have both windows visible.
CRAP!

No such menu item exists:
-
SShot 2021-11-04 at 11.54.53.png

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9354
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Python Projects

Post by richmond62 » Thu Nov 04, 2021 11:01 am

A Totally Pointless Exercise:
-
SShot 2021-11-04 at 11.57.33.png
SShot 2021-11-04 at 11.57.33.png (25.46 KiB) Viewed 13270 times
-
Quite apart from the fact that 'print' seems majorly counter-intuitive
as it does NOT print.
-
Equally pointless exercise:
-
SShot 2021-11-04 at 11.59.53.png
-
"Excuse me, Sir, but WTF does 'Hello World' mean?"

Or, putting things more directly: what pedagogical purpose does that serve?
Congratulations on your first Python program :D (PS! You can tell it to print anything you like, why not change it to say hello to you? Change it to say your name instead)
Childish.

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9354
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Python Projects

Post by richmond62 » Thu Nov 04, 2021 11:43 am

1. Open a new code window (From the File menu) and write the following:
2. Save your program as myturtle.py and choose Run -> Run Module. See how the turtle moved forward 100 pixels? The turtle has a pen attached, and draws lines as it moves around the screen.
-
SShot 2021-11-04 at 12.38.43.png
SShot 2021-11-04 at 12.38.43.png (9.12 KiB) Viewed 13255 times
-
This is very odd code to my mind as it doesn't say WHERE (as in, 'from') a 'turtle' might be,
and what '*' might mean (as in, 'import'). The end result is not really very instructive at all, mainly because
I cannot see a turtle:
-
SShot 2021-11-04 at 12.39.32.png
SShot 2021-11-04 at 12.39.32.png (3.46 KiB) Viewed 13255 times
-
And that arrow turns up in a 3rd window.

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9354
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Python Projects

Post by richmond62 » Thu Nov 04, 2021 12:15 pm

Let's set up an initial stack in LiveCode to work with:
-
SShot 2021-11-04 at 13.12.57.png
-
Turtle Moves.livecode.zip
(10.15 KiB) Downloaded 142 times
-
In my stack the turtle is VISIBLE.

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9354
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Python Projects

Post by richmond62 » Thu Nov 04, 2021 1:04 pm

In some respects it might be better to leave children to enter Turtle Graphics commands into a field:
-
SShot 2021-11-04 at 14.00.24.png
-
Although, to be honest, this teaches them exactly NOTHING about LiveCode

[and, similarly the Python exercise teaches NOTHING about Python, so while
Turtle Graphics may have some value, the ONLY reason I can see of implementing it in
any programming language is to "suck" children into using that language later on.]
-
I asked Wilfred, the plastic turtle we bought at St. Louis zoo (which I can thoroughly recommend)
in 1994, and he couldn't answer that one either.
-
TG.jpg
Attachments
Turtle Moves #2.livecode.zip
Here's the stack.
(10.6 KiB) Downloaded 147 times

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9823
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Python Projects

Post by FourthWorld » Thu Nov 04, 2021 4:04 pm

richmond62 wrote:
Thu Nov 04, 2021 11:01 am
Quite apart from the fact that 'print' seems majorly counter-intuitive
as it does NOT print.
It prints to the screen.

Most languages use it.

What does "put" mean to someone who doesn't already know?

Many function names in languages are somewhat arbitrary. Few are perfect. None are truly intuitive, any more than driving a car is intuitive, though it may subjectively feel that way to one who's been driving a car for many decades.

In October, Python reached the #1 slot on the TIOBE Index. Of course popularity is not necessarily an indicator of quality, but it is an indicator of popularity.

When comparing other languages to LC I used to try to come up with arguments about why the world was wrong. These days I try to ask myself what fans of other languages find attractive. This shift in perspective has taught me more.

LC has many advantages. As does Python. And JavaScript. And all the rest.

There's a reason so many languages exist. And outside of our little corner of the world, most programmers are polyglots.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9354
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Python Projects

Post by richmond62 » Thu Nov 04, 2021 6:00 pm

What does "put" mean to someone who doesn't already know?
Not much.

stam
Posts: 2679
Joined: Sun Jun 04, 2006 9:39 pm
Location: London, UK

Re: Python Projects

Post by stam » Fri Nov 05, 2021 10:11 am

FourthWorld wrote:
Thu Nov 04, 2021 4:04 pm
And outside of our little corner of the world, most programmers are polyglots.
True, true... i suspect to a large extent this is because of the commonalities of C-style OOP languages, which makes it easier to bridge across different languages, whereas LC stands apart conceptually and syntactically (not better or worse, just a bit too different).

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9354
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Python Projects

Post by richmond62 » Fri Nov 05, 2021 5:04 pm

LC stands apart conceptually and syntactically
But, arguably, easier to understand by children just because of that.

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9354
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Python Projects

Post by richmond62 » Sun Nov 07, 2021 5:21 pm

SShot 2021-11-07 at 18.20.40.png
-
Well, 90 degree turns have already been addressed in the stack posted earlier.
-
Frankly for other turns I cannot be bothered to do that all over again, so I am posting
something I made in 2017:
-
SShot 2021-11-07 at 18.26.29.png
Attachments
NLCT.livecode.zip
Here we are.
(121.57 KiB) Downloaded 149 times

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9354
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Python Projects

Post by richmond62 » Sun Nov 07, 2021 5:33 pm

If you are wondering about my design for my buttons; they are loosely based
on those on top of a Valiant Roamer 2 robot:
-
R2.jpeg
-
and those on a BlueBot robot:
-
blueB.jpeg
blueB.jpeg (5.61 KiB) Viewed 12661 times
-
blueBcontrols.jpeg
blueBcontrols.jpeg (15.83 KiB) Viewed 12661 times
Last edited by richmond62 on Wed Nov 10, 2021 9:24 am, edited 1 time in total.

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9354
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Python Projects

Post by richmond62 » Sun Nov 07, 2021 5:35 pm

SShot 2021-11-07 at 18.34.16.png
-
Obviously ALL of this can be managed in my NLCT.livecode
stack.
-
Mind you, my experience is that children will soon get bored with this sort of thing:
-
SShot 2021-11-07 at 18.36.05.png
-
They might be far better to do this sort of thing with a physical 'turtle' of
some sort or other:
-
vTurtle.jpeg
vTurtle.jpeg (7.38 KiB) Viewed 12659 times
-

Post Reply

Return to “Teaching with LiveCode”