| Author |
Message |
disciple
Joined: 20 May 2006 Posts: 6179 Location: Auckland, New Zealand
|
Posted: Sun 12 Feb 2012, 07:24 Post subject:
Instant Hacking: an introduction to the art of programming Subject description: Python based |
|
| Quote: | | This is a short introduction to the art of programming, with examples written in the programming language Python. (If you already know how to program, but want a short intro to Python, you may want to check out my article Instant Python.) This article has been translated into Italian, Polish, Japanese, Serbian, Brazilian Portuguese, Dutch, and Czech. |
http://hetland.org/writing/instant-hacking.html
Note that Python is not usually included in Puppy.
_________________ DEATH TO SPREADSHEETS
- - -
Classic Puppy quotes
- - -
Beware the demented serfers!
|
|
Back to top
|
|
 |
antiloquax

Joined: 27 Jan 2012 Posts: 405
|
Posted: Tue 14 Feb 2012, 11:38 Post subject:
|
|
This looks good. I like Python.
If you don't have Python 3 on your system (Python 2 comes with the devx), you might want to use this pet for Python 3.1.4.
Python 3.1.4
[Edit] The pygame PET I made, does not work - link removed. Instructions on installing pygame follow in a new post].
This website has some useful pets too - Cairo, TK and TCL - which you also need.
I'll also add a couple of useful tutorials I have used:
A Byte of Python
Introduction to Computer Science Using Python and Pygame
mark
| Description |
|

Download |
| Filename |
PythonTutorials.tar.gz |
| Filesize |
1.58 MB |
| Downloaded |
103 Time(s) |
Last edited by antiloquax on Fri 17 Feb 2012, 01:29; edited 1 time in total
|
|
Back to top
|
|
 |
disciple
Joined: 20 May 2006 Posts: 6179 Location: Auckland, New Zealand
|
Posted: Wed 15 Feb 2012, 04:47 Post subject:
|
|
| Quote: | | This website has some useful pets too - Cairo, TK and TCL - which you also need. |
What do you mean? You need them for Pygame?
And out of interest, why should people use Python 3? Just because it is the way of the future? Or are there other benefits?
_________________ DEATH TO SPREADSHEETS
- - -
Classic Puppy quotes
- - -
Beware the demented serfers!
|
|
Back to top
|
|
 |
antiloquax

Joined: 27 Jan 2012 Posts: 405
|
Posted: Wed 15 Feb 2012, 08:01 Post subject:
|
|
When installing Pythong, I needed TK and TCL for the tkinter module, which the Python IDLE relies on.
I must admit that I am not absolutely sure what Cairo does ! But I couldn't get Python 3 to install properly without it.
I am learning Python 3 mainly because I had never learned Python before, so it seemed to make sense to go with the newer version. Installing it will not harm your existing Python 2.x installation (which many applications need).
Python is on version 3.2.2 (I think). However, Pygame tends to lag behind a bit - the newest version works best with Python 3.1.4.
As I say, I don't know much about the history of Python. One thing I have seen mentioned is that "print" is function like any other. So it's:
>>> print("Hello World")
Rather than
>>> print "Hello World"
etc.
The other reason was that I bought Michael Dawson's (very good) "Python Programming for the Absolute Beginner" - which is about Python3.
_________________ My System:Arch-Arm on RPi!
"RacyPy" puplet on Toshiba Tecra 8200. PIII, 256 MB RAM.
RaspberryPy: Lobster and I blog about the RPi.
|
|
Back to top
|
|
 |
GustavoYz

Joined: 07 Jul 2010 Posts: 866 Location: .ar
|
Posted: Thu 16 Feb 2012, 08:16 Post subject:
|
|
@Disciple:
http://docs.python.org/release/3.0.1/whatsnew/3.0.html
|
|
Back to top
|
|
 |
antiloquax

Joined: 27 Jan 2012 Posts: 405
|
Posted: Thu 16 Feb 2012, 09:17 Post subject:
|
|
Thanks, GustavoYz - I'll have a look at that myself, as this question comes up fairly often.
I know that Arch Linux comes with Python 3 as default, which has caused some problems. Since the versions will co-exist happily it seems to me that we should have Python 2.x for software and Python 3.x for leaning to program.
_________________ My System:Arch-Arm on RPi!
"RacyPy" puplet on Toshiba Tecra 8200. PIII, 256 MB RAM.
RaspberryPy: Lobster and I blog about the RPi.
|
|
Back to top
|
|
 |
Lobster
Official Crustacean

Joined: 04 May 2005 Posts: 15109 Location: Paradox Realm
|
Posted: Thu 16 Feb 2012, 10:23 Post subject:
|
|
I like Python. However I have never been able to create a Gui with Python.
It is usually the first thing I want to do.
Have you done it? How?
As far as I know Python is available in the devx
- so you could use Glade as the GUI creation tool - again never found that straight forward.
Also available in the devx is the genie language which is python and BASIC like - but compiled . . .
http://puppylinux.org/wikka/ValaGenieintro
_________________ Puppy WIKI
|
|
Back to top
|
|
 |
antiloquax

Joined: 27 Jan 2012 Posts: 405
|
Posted: Thu 16 Feb 2012, 12:50 Post subject:
Subject description: GUI |
|
Hi Lobster, I am very much a newbie at Python. You can create GUIs with the tkinter module I mentioned above.
I don't know how to make the buttons DO anything, but I have played around with this (from Michael Dawson's book),
| Description |
|
| Filesize |
3.67 KB |
| Viewed |
454 Time(s) |

|
| Description |
|
| Filesize |
39.15 KB |
| Viewed |
451 Time(s) |

|
_________________ My System:Arch-Arm on RPi!
"RacyPy" puplet on Toshiba Tecra 8200. PIII, 256 MB RAM.
RaspberryPy: Lobster and I blog about the RPi.
|
|
Back to top
|
|
 |
disciple
Joined: 20 May 2006 Posts: 6179 Location: Auckland, New Zealand
|
Posted: Thu 16 Feb 2012, 22:02 Post subject:
|
|
| antiloquax wrote: | | I know that Arch Linux comes with Python 3 as default |
I didn't notice it come with any Python... which is what I'd expect for "the Arch way"
Incidentally I think currently all the programs I have which use Python are using Python2... but I think there might be at least one I've built from the AUR to avoid the "Python" dependency of the official package.
| Lobster wrote: | | As far as I know Python is available in the devx so you could use Glade as the GUI creation tool - again never found that straight forward. |
Does that require PyGTK?
Does the devx include either Pyglade (or whatever it's called) or PyGTK?
You might be interested in this thread, although it isn't about python and glade: http://www.murga-linux.com/puppy/viewtopic.php?p=603859&search_id=234761277#603859
The thread is about the old version of the Glade designer, which supports code generation. But that post of mine has a link to a similar thing for Vala.
_________________ DEATH TO SPREADSHEETS
- - -
Classic Puppy quotes
- - -
Beware the demented serfers!
|
|
Back to top
|
|
 |
antiloquax

Joined: 27 Jan 2012 Posts: 405
|
Posted: Thu 16 Feb 2012, 23:40 Post subject:
|
|
| disciple wrote: |
I didn't notice it come with any Python... which is what I'd expect for "the Arch way"  |
I've just realised that the PET I made for Pygame does not work. I think you just have to do it like this:
1. Download Pygame 1.9.1.
2. Make sure you have SDL DEV package and your DEVX (for compiling).
3. When you have extracted the tarball, open a console in the directory and do this:
python3.1 config.py
2to3 setup.py -w
python3.1 setup.py build
python3.1 setup.py install
_________________ My System:Arch-Arm on RPi!
"RacyPy" puplet on Toshiba Tecra 8200. PIII, 256 MB RAM.
RaspberryPy: Lobster and I blog about the RPi.
|
|
Back to top
|
|
 |
Lobster
Official Crustacean

Joined: 04 May 2005 Posts: 15109 Location: Paradox Realm
|
Posted: Mon 20 Feb 2012, 01:14 Post subject:
|
|
| Quote: | Does that require PyGTK?
Does the devx include either Pyglade (or whatever it's called) or PyGTK? |
As far as I am aware it only includes Python and also Idle (the editor) I seem to remember.
Tkinter requires the tkl language which is no longer standard in Puppy. Even with Tkl, the most I got it to do is some non functioning buttons - much as you have shown - unless linked to code this is of no use.
It was the jump from example to functioning GUI code that I can not achieve in Python.
I am game. Will try some more . . .
_________________ Puppy WIKI
|
|
Back to top
|
|
 |
antiloquax

Joined: 27 Jan 2012 Posts: 405
|
Posted: Mon 20 Feb 2012, 01:25 Post subject:
|
|
| Lobster wrote: | . Even with Tkl, the most I got it to do is some non functioning buttons - much as you have shown - unless linked to code this is of no use.
|
That's interesting ... I haven't got that far with learning the language yet - I'll see what happens.
mark
_________________ My System:Arch-Arm on RPi!
"RacyPy" puplet on Toshiba Tecra 8200. PIII, 256 MB RAM.
RaspberryPy: Lobster and I blog about the RPi.
|
|
Back to top
|
|
 |
|