471,337 Members | 1,234 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,337 software developers and data experts.

Should I use Python for these programs?

CC
Hi:

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

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

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.

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.

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.

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

Any input will be appreciated.
--
_____________________
Christopher R. Carlen
cr***@bogus-remove-me.sbcglobal.net
SuSE 9.1 Linux 2.6.5
Jul 10 '07 #1
10 1443
On 2007-07-10, CC <cr***@BOGUS.sbcglobal.netwrote:
I wish to accomplish a few PC programming tasks, and am
considering to learn Python:

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.

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.
I do a lot of that sort of thing using Python. I'd probably
recommend using pyserial and wxWidgets. Both are
cross-platform.

http://pyserial.sourceforge.net/
http://www.wxpython.org/

In any case, both "normal" PC serial ports and USB-serial ports
looks the same to a Linux app. Windows support for stuff like
that wasn't so good last time I tried, but it's supposed to work.
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.
Most of the graphics I do with Python is with Gnuplot (not
really appropriate for what you want to do.
wxWidgets/Floatcanvas might be worth looking into.
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.
Not at all. Cross-platform serial stuff is easy.
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.

Tk's canvas widget is pretty powerful, and you don't need to
know Tcl -- it's all hidden behind a veneer of Python.
Do you think Python is the right language for these projects?
It's what I use for stuff like that.

--
Grant Edwards grante Yow! MERYL STREEP is my
at obstetrician!
visi.com
Jul 10 '07 #2
On Jul 10, 5:09 am, CC <c...@BOGUS.sbcglobal.netwrote:
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.
You may look at dia for that.

Michele Simionato
Jul 10 '07 #3
"CC" <cr***@BOGUS.s....l.netwrote:
>
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

Jul 10 '07 #4
Grant Edwards wrote:
Most of the graphics I do with Python is with Gnuplot (not
really appropriate for what you want to do.
wxWidgets/Floatcanvas might be worth looking into.
Agreed (I'm quite sure you mean wxPython though). Also, in "wxPython
in Action" (the official book) a simple drawing app is constructed.
It could help to start from there.

Regards,
Björn

--
BOFH excuse #211:

Lightning strikes.

Jul 10 '07 #5
CC <cr***@BOGUS.sbcglobal.netwrote:
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

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

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.

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.
No problems - pyserial, wxPython work fine cross platform. You can
also use libusb from python from windows and linux also for low level
USB stuff. I've managed to use all those things successfully.
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.
On the contrary, pyserial does a very good job of abstracting the
serial port away.
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.
Use wxPython would be my advice. tk is OK, but a bit clunky. it does
have the advantage that it is built into the language though.
Do you think Python is the right language for these projects?
Yes!

--
Nick Craig-Wood <ni**@craig-wood.com-- http://www.craig-wood.com/nick
Jul 10 '07 #6
CC
Hendrik van Rooyen wrote:
"CC" <cr***@BOGUS.s....l.netwrote:[edit]
>>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"
Yeah, that's neato. Trouble is, I work at a national lab, which is
where some of these apps will be developed. They have a big problem
with ethernet devices. Basically, it's almost impossible to use
ethernet on other than PCs, on the official LAN.

I will have to look into this further though, as higher data rate stuff
is a problem with serial. Although I could do 10Mbps RS-422 I suppose.
>>[edit]
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... :- ) )
Yeah, that's really great. Our in-house programmer uses wxPython, I've
discovered, so that's a strong push in that direction. Though he isn't
totally unfamiliar with TkInter too.
>>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"
Thanks for the input.

I am not seeing anything to indicate that Python isn't the direction in
which I should head.

Good day!
--
_____________________
Christopher R. Carlen
cr***@bogus-remove-me.sbcglobal.net
SuSE 9.1 Linux 2.6.5
Jul 11 '07 #7
CC
Bjoern Schliessmann wrote:
Grant Edwards wrote:
>>Most of the graphics I do with Python is with Gnuplot (not
really appropriate for what you want to do.
wxWidgets/Floatcanvas might be worth looking into.

Agreed (I'm quite sure you mean wxPython though). Also, in "wxPython
in Action" (the official book) a simple drawing app is constructed.
It could help to start from there.
Ooh, that's interesting.

The programming contractor at work who does all our DAQ stuff also uses
wxPython so it's looking like I should use that since I can get lots of
help.
Thanks for the book tip.


--
_____________________
Christopher R. Carlen
cr***@bogus-remove-me.sbcglobal.net
SuSE 9.1 Linux 2.6.5
Jul 11 '07 #8
CC
Michele Simionato wrote:
On Jul 10, 5:09 am, CC <c...@BOGUS.sbcglobal.netwrote:
>>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.

You may look at dia for that.

Michele Simionato
Thanks for the input.

Yes, I will have a look. Makes sense to check out if any drawing progs
can do what I want off the shelf.

But it might be fun to write one anyway!


--
_____________________
Christopher R. Carlen
cr***@bogus-remove-me.sbcglobal.net
SuSE 9.1 Linux 2.6.5
Jul 11 '07 #9
On 7/10/07, CC <cr***@bogus.sbcglobal.netwrote:
Bjoern Schliessmann wrote:
Grant Edwards wrote:
>Most of the graphics I do with Python is with Gnuplot (not
really appropriate for what you want to do.
wxWidgets/Floatcanvas might be worth looking into.
Agreed (I'm quite sure you mean wxPython though). Also, in "wxPython
in Action" (the official book) a simple drawing app is constructed.
It could help to start from there.

Ooh, that's interesting.

The programming contractor at work who does all our DAQ stuff also uses
wxPython so it's looking like I should use that since I can get lots of
help.

Since the book was written, wxPython has grown a vector graphics
system that might be more suitable for your needs. Look at the
wxGraphicsContext class.
Jul 11 '07 #10
"CC" <cr***@BOGUS.sbcglobal.netwrote:

8< -----------------------------------------------------------
Basically, it's almost impossible to use
ethernet on other than PCs, on the official LAN.

I will have to look into this further though, as higher data rate stuff
is a problem with serial. Although I could do 10Mbps RS-422 I suppose.
This kind of implies USB into the PC - Haven't seen a 16550 driven much
above 1Mb/s

As you have a DSP in the system think about USB (with the chips you mentioned)
into a DSP then the DSP's serial port converted to RS-485 for every signal
(clock, data in and out and sync) and then everything is native DSP on the
remote device.

That gives you multiple channels of better than Audio response, full duplex.

And since your eyes are slower than your ears, that should be good enough...

- Hendrik

Jul 12 '07 #11

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

19 posts views Thread by KefX | last post: by
47 posts views Thread by Michael Scarlett | last post: by
14 posts views Thread by Sam | last post: by
reply views Thread by Fuzzyman | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.