我应该在这些程序中使用Python吗? [英] Should I use Python for these programs?

查看:78
本文介绍了我应该在这些程序中使用Python吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨:


我有相当的C和汇编语言经验。然而,这些

主要是嵌入式微控制器,因为我从1988年开始远离PC

编程:-O


我希望完成一些PC编程任务,并且正在考虑

学习Python:


1.开发一个在Linux上运行的简单GUI程序和Windows可以通过RS-232或USB将参数和小块数据发送到嵌入式微控制器

设备。还显示从设备发送的简单数据(可能是单个

数字)。


注意,如果是USB,那么客户端将由我使用FTDI

芯片在PC上显示为串口。


2.开发一个简单的矢量绘图程序,允许一个

徒手绘制由几行组成的草图,或者以矢量形式渲染文本

。然后用一定的(用户

可配置)间距对线条进行采样,并使用鼠标沿着线条移动采样点,如果需要,可以调整线条来调整样本位置。然后为样本输出一个文件

的X,Y坐标。


这个疯狂的东西是什么?这是开发简单的激光矢量

帧。我也在设计一个基于DSP的激光输出设备,因此这里需要通过串口/ USB向

目标设备提供数据有效负载的相同功能。好吧。


我希望能够在Linux和Windows之间编写一个跨平台的程序。我意识到串口通信可能特别有问题。


我也被过多的Python GUI扩展所困惑,尽管

Tkinter似乎是一个可能的候选人。我不确定如果我不知道Tcl / Tk,我是否会学习如何使用这个问题。


你认为Python是这些项目的正确语言?


任何输入都将受到赞赏。

-

_____________________

Christopher R. Carlen
cr***@bogus-remove-me.sbcglobal.net

SuSE 9.1 Linux 2.6.5

解决方案

2007-07-10,CC< cr *** @ BOGUS.sbcglobal.net写道:


我希望完成一些PC编程任务,并且考虑学习Python,我是



1.开发一个简单的GUI程序,在Linux和Windows上运行

,它可以将参数和小块数据发送到

嵌入式微控制器设备通过RS-232或USB。另外

显示从

设备发送的简单数据(可能是单个数字)。


注意,如果是USB,那么客户端将使用FTDI芯片来实现,这些芯片在PC上显示为串行端口。



我使用Python做了很多这样的事情。我可能会建议使用pyserial和wxWidgets。两者都是跨平台的b $ b。

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


无论如何,两者都是正常的。 PC串口和USB串口

看起来与Linux应用程序相同。 Windows支持像

这样的东西上次尝试时并不是那么好,但是它应该可以工作。


2.开发一个简单的矢量绘图程序,允许一个

徒手绘制由几行组成的草图,或者

可能以矢量形式渲染文本。然后使用特定(用户可配置的)间距对

行进行采样,并使用鼠标将b / b
沿着线条移动到

如果需要,可以调整样本位置。然后为样本输出一个文件

的X,Y坐标。


这个疯狂的东西是什么?这是开发简单的

lasershow矢量帧。我也在设计一个基于DSP的

lasershow输出设备,因此具有相同的功能

通过串口/ USB向目标提供数据有效载荷
$ b这里也需要$ b设备。



我用Python做的大多数图形都是用Gnuplot(而不是

wxWidgets / Floatcanvas可能值得研究。


我希望能够编写一个跨平台的程序
$ b Linux和Windows之间的$ b。我意识到串行通信可能特别有问题。



完全没有。跨平台连续的东西很容易。


我也被过多的Python GUI扩展所困惑,

虽然Tkinter似乎是一个可能的候选人。我我不确定

如果我不能学习如何使用这个,如果我不知道
知道Tcl / Tk。



Tk'的画布小部件非常强大,你不需要知道Tcl - 它全部隐藏在Python的外观背后。


您认为Python是这些项目的正确语言吗?



这就是我用的东西。


-

格兰特爱德华兹格兰特哇! MERYL STREEP是我的

产科医生!

visi.com


7月10日上午5:09, CC< c ... @ BOGUS.sbcglobal.netwrote:


2.开发一个简单的矢量绘图程序,允许一个

徒手绘制由几行组成的草图,或者以矢量形式渲染文本

。然后用一定的(用户

可配置)间距对线条进行采样,并使用鼠标沿着线条移动采样点,如果需要,可以调整线条来调整样本位置。然后为样本输出一个文件

的X,Y坐标。



你可以看看dia。


Michele Simionato


" CC" < cr *** @ BOGUS.s .... l.netwrote:


>

我有相当多的C和汇编语言经验。然而,这些

主要是在嵌入式微控制器上,因为我从1988年开始远离PC

编程:-O



你的经历与我的相似,不同之处在于我的汇编程序过多...


>

我希望完成一些PC编程任务,并考虑到
学习Python:



去吧 - 你会很高兴简单复杂的东西,

并且厌倦了你必须跳过去做低等级的东西,

但是权衡取舍值得痛苦。


>

1.开发一个简单的GUI程序,在Linux和Windows上运行,可以发送参数和
嵌入式微控制器的数据块

设备通过RS-232或USB。还显示从设备发送的简单数据(可能是单个

数字)。



如果你在Lantronix Xport上花一点钱,你可以使用以太网,

然后linux / windows问题就会消失 - 因为套接字似乎是

只是工作


>

注意,如果是USB然后客户端将由我实现使用FTDI

芯片,这些芯片在PC上显示为串口。


2.开发一个简单的矢量绘图程序这将允许一个人徒手绘制由几行组成的草图,或者以矢量形式渲染文本

。然后用一定的(用户

可配置)间距对线条进行采样,并使用鼠标沿着线条移动采样点,如果需要,可以调整线条来调整样本位置。然后为样本输出一个文件

的X,Y坐标。


这个疯狂的东西是什么?这是开发简单的激光矢量

帧。我也在设计一个基于DSP的激光输出设备,因此这里需要通过串口/ USB向

目标设备提供数据有效负载的相同功能。好吧。


我希望能够在Linux和Windows之间编写一个跨平台的程序。我意识到这可能特别对于串口通信而言是有问题的。



true - 它不完全相同。


>

我也对过多的Python GUI扩展感到困惑,尽管

Tkinter似乎是一个可能的候选者。我不确定如果我不知道Tcl / Tk,我是否会学习如何使用这个难以获得



否 - 网上有很好的例子和文档。

除非你做的事非常花哨,否则你不需要需要 ;知道Tcl。


开发周期很快,如果你遇到困难你可以得到帮助

这里 - 这是一群超级人物(说他谦虚......: - ))


>

你认为Python是这些项目的正确语言吗?



是的 - 我正在完成注塑机

控制器,在tkinter中使用GUI(cos在标准中图书馆),

带有机器功能的粗略动画 - 而且全部只是工作


在我的情况下,操作系统是linux,并且接口是串行的 - 但是我不是为了跨平台兼容性而尝试
。 - 我已经实现了一个滑动的

窗口全双工可靠协议,因此可以使用Python来与串口设备进行
对话。 (在115200,所以它不是那个慢)


>

任何输入都将不胜感激。



hth - Hendrik


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

解决方案

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


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


"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


这篇关于我应该在这些程序中使用Python吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆