473,406 Members | 2,705 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 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 1523
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

19
by: KefX | last post by:
I've been following the group a bit (somewhat loosely; discussions involving other languages or advanced concepts kind of lose me), and I see all this negativity (OMG Python's lambda is borken...
47
by: Michael Scarlett | last post by:
There is an amazing article by paul graham about python, and an even better discussion about it on slashdot. The reason I point this out, is the more I read both articles, the more I realised how...
14
by: Sam | last post by:
Hi, I have been developing sites and cms's for the past few years using PHP and mysql. I've been interested in learning a new language and was considering Python. I have a pretty decent grasp of...
35
by: Michael Kearns | last post by:
I've been using python to write a simple 'launcher' for one of our Java applications for quite a while now. I recently updated it to use python 2.4, and all seemed well. Today, one of my...
0
by: Fuzzyman | last post by:
It's finally happened, `Movable Python <http://www.voidspace.org.uk/python/movpy/>`_ is finally released. Versions for Python 2.3 & 2.4 are available from `The Movable Python Shop...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.