Should I use Python for these programs?

Hendrik van Rooyen mail at microcorp.co.za
Tue Jul 10 09:34:15 CEST 2007


 "CC" <crobc at BOGUS.s....l.net> wrote:

> 
> I have considerable C and assembly language experience.  However, these 
> are mostly on embedded microcontrollers since I moved away from PC 
> programming all the way back in 1988 :-O

Your experience parallels mine, except that mine has a surfeit of assembler...

> 
> I wish to accomplish a few PC programming tasks, and am considering to 
> learn Python:

go for it - you will be delighted with the simplicity of the complex stuff,
and irritated at the hoops that you have to jump through to do low level stuff,
but the trade off is worth the pain.

> 
> 1.  Develop a simple GUI program to run on Linux and Windows which can 
> send parameters and small blocks of data to an embedded microcontroller 
> device via RS-232 or USB.  Also display simple data (probably single 
> numbers) sent from the device.

If you spend a bit of money on a Lantronix Xport, you can use ethernet,
and then the linux/windows problems goes away - as sockets seem to 
"just work"

> 
> Note, if it is USB, then the client will be implemented by me using FTDI 
> chips that appear to the PC as a serial port.
> 
> 2.  Develop a simple vector drawing program that will allow one to 
> freehand draw a sketch composed of a few lines, or perhaps render text 
> in a vector form.  Then sample the lines with a certain (user 
> configurable) spacing, and use the mouse to move the sample points along 
> the lines to tweak the sample locations if desired.  Then output a file 
> of X,Y coordinates for the samples.
> 
> What is this crazy thing for?  It's to develop simple lasershow vector 
> frames.  I am also designing a DSP-based lasershow output device, so the 
> same capabilities of delivering a data payload over serial/USB to a 
> target device will be needed here as well.
> 
> I would prefer to be able to write a program that is cross-platform 
> between Linux and Windows.  I realize this might be especially 
> problematic with the serial comms.

true - its not quite the same.

> 
> I am also confused by the plethora of Python GUI extensions, though 
> Tkinter seems like a likely candidate.  I am uncertain if I will have 
> difficulty learning how to use this if I don't know Tcl/Tk.

No - there are excellent examples and docs available on the web.
Unless you are doing something very fancy, you dont "need" to know Tcl.

The development cycle is fast, and if you get stuck you can get help
here - this is a super group of people (said he modestly...   :- )  )

> 
> Do you think Python is the right language for these projects?

Yes - I am in the process of finishing an Injection Moulding Machine 
Controller, with the GUI in tkinter (cos its in the standard library),
with some crude animation of the machine functions - and it all "just works"

In my case, the OS is linux, and the interface is serial - but then I am not 
trying for cross platform compatibility. - I have implemented a sliding
window full duplex reliable protocol, so it is possible to use Python to 
talk to a serial device. (at 115200, so its not "that" slow)

> 
> Any input will be appreciated.
> 

hth - Hendrik






More information about the Python-list mailing list