2004年03月10日 星期三 18:14
小弟初学 Python,我在用PYTHON 编一个NOTEPAD,就是WINDOWS 那种,而且是完全模仿的。有几个问题搁着,网上查了好久,一直无法解决。 1、 剪切板里操作。 clipboard_append(str) 将内容送入剪切板,clipboard_clear()于清空,但怎么取出里面的内容呢?(不要笑我,我确实找不出来) 2、 “关于”对话框, os.sys.getwindowsversion() 可以得到系统部分信息,但怎么得到系统当前用户、物理内存等信息,像 windows notepad 的帮助那样。我只是想很好地模仿、实践中学习 python。 3、 通过努力,读、写、修改等基本功能可以实现。但发现对中文支持不够,有什么办法? 谢谢。 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20040310/6a17fab2/attachment.htm
2004年03月10日 星期三 18:36
把MySQLdb.escape_string去掉,应该就行了。 ------- Explicit is better than implicit ... -----Original Message----- From: Dirk [mailto:mailing at wandy.cn] Sent: 2004年3月10日 18:40 To: python-chinese at lists.python.cn Subject: Re: [python-chinese] 请教一个问题。 Here is my sample code: strSQLCmd = "UPDATE tablename SET keyvalue='abcd',morevalue=%s WHERE keyid=%s" Cursor.execute(strSQLCmd, (MySQLdb.escape_string(""""""), '13')) Could you help me ?? Thanks. ----- Original Message ----- From: "Jacob Fan" <jacob at exoweb.net> To: <python-chinese at lists.python.cn> Sent: Wednesday, March 10, 2004 5:23 PM Subject: RE: [python-chinese] 请教一个问题。 你试过类似这样的做法么? cursor.execute("insert into article (title,body) values(%s,%s)", ("abc", "jflksjfklsdjl\"fjdksf\"fd")) ------- Explicit is better than implicit ... -----Original Message----- From: Dirk [mailto:mailing at wandy.cn] Sent: 2004年3月10日 16:26 To: Chinese Python List Subject: [python-chinese] 请教一个问题。 我在插入MySQL数据的时候,使用MySQLdb.escape_string()方法,如: 会被转换成: 然后我从数据库检索出来的时候,还是留着\,没有去掉,请问有没有函数是escape_string的相反功能,就像PHP中的addslashes()函数对应stripslashes()函数。。。。 谢谢! _______________________________________________ python-chinese list python-chinese at lists.python.cn http://python.cn/mailman/listinfo/python-chinese
2004年03月10日 星期三 18:43
你多此一举了,用这种带参数的方式调用sql,参数里的内容会自动escape。 ------- Explicit is better than implicit ... -----Original Message----- From: Jacob Fan Sent: 2004年3月10日 18:37 To: python-chinese at lists.python.cn Subject: RE: [python-chinese] 请教一个问题。 把MySQLdb.escape_string去掉,应该就行了。 ------- Explicit is better than implicit ... -----Original Message----- From: Dirk [mailto:mailing at wandy.cn] Sent: 2004年3月10日 18:40 To: python-chinese at lists.python.cn Subject: Re: [python-chinese] 请教一个问题。 Here is my sample code: strSQLCmd = "UPDATE tablename SET keyvalue='abcd',morevalue=%s WHERE keyid=%s" Cursor.execute(strSQLCmd, (MySQLdb.escape_string(""""""), '13')) Could you help me ?? Thanks. ----- Original Message ----- From: "Jacob Fan" <jacob at exoweb.net> To: <python-chinese at lists.python.cn> Sent: Wednesday, March 10, 2004 5:23 PM Subject: RE: [python-chinese] 请教一个问题。 你试过类似这样的做法么? cursor.execute("insert into article (title,body) values(%s,%s)", ("abc", "jflksjfklsdjl\"fjdksf\"fd")) ------- Explicit is better than implicit ... -----Original Message----- From: Dirk [mailto:mailing at wandy.cn] Sent: 2004年3月10日 16:26 To: Chinese Python List Subject: [python-chinese] 请教一个问题。 我在插入MySQL数据的时候,使用MySQLdb.escape_string()方法,如: 会被转换成: 然后我从数据库检索出来的时候,还是留着\,没有去掉,请问有没有函数是escape_string的相反功能,就像PHP中的addslashes()函数对应stripslashes()函数。。。。 谢谢! _______________________________________________ python-chinese list python-chinese at lists.python.cn http://python.cn/mailman/listinfo/python-chinese _______________________________________________ python-chinese list python-chinese at lists.python.cn http://python.cn/mailman/listinfo/python-chinese
2004年03月10日 星期三 18:57
thanks.......... ----- Original Message ----- From: "Jacob Fan" <jacob at exoweb.net> To: <python-chinese at lists.python.cn> Sent: Wednesday, March 10, 2004 6:43 PM Subject: RE: [python-chinese] 请教一个问题。 你多此一举了,用这种带参数的方式调用sql,参数里的内容会自动escape。 ------- Explicit is better than implicit ... -----Original Message----- From: Jacob Fan Sent: 2004年3月10日 18:37 To: python-chinese at lists.python.cn Subject: RE: [python-chinese] 请教一个问题。 把MySQLdb.escape_string去掉,应该就行了。 ------- Explicit is better than implicit ... -----Original Message----- From: Dirk [mailto:mailing at wandy.cn] Sent: 2004年3月10日 18:40 To: python-chinese at lists.python.cn Subject: Re: [python-chinese] 请教一个问题。 Here is my sample code: strSQLCmd = "UPDATE tablename SET keyvalue='abcd',morevalue=%s WHERE keyid=%s" Cursor.execute(strSQLCmd, (MySQLdb.escape_string(""""""), '13')) Could you help me ?? Thanks. ----- Original Message ----- From: "Jacob Fan" <jacob at exoweb.net> To: <python-chinese at lists.python.cn> Sent: Wednesday, March 10, 2004 5:23 PM Subject: RE: [python-chinese] 请教一个问题。 你试过类似这样的做法么? cursor.execute("insert into article (title,body) values(%s,%s)", ("abc", "jflksjfklsdjl\"fjdksf\"fd")) ------- Explicit is better than implicit ... -----Original Message----- From: Dirk [mailto:mailing at wandy.cn] Sent: 2004年3月10日 16:26 To: Chinese Python List Subject: [python-chinese] 请教一个问题。 我在插入MySQL数据的时候,使用MySQLdb.escape_string()方法,如: 会被转换成: 然后我从数据库检索出来的时候,还是留着\,没有去掉,请问有没有函数是escape_string的相反功能,就像PHP中的addslashes()函数对应stripslashes()函数。。。。 谢谢! _______________________________________________ python-chinese list python-chinese at lists.python.cn http://python.cn/mailman/listinfo/python-chinese _______________________________________________ python-chinese list python-chinese at lists.python.cn http://python.cn/mailman/listinfo/python-chinese _______________________________________________ python-chinese list python-chinese at lists.python.cn http://python.cn/mailman/listinfo/python-chinese
2004年03月10日 星期三 21:06
Hello sherking,
ÔÚÏÂÖ»ÄÜ´óÖÂÌáʾһÏÂ×ÓÎÊÌâ3:
ÖÐÎÄÖ§³Ö;
Èç¹ûÏëÍêÃÀµÄÖ§³ÖÖÐÎÄ£¬¿ÉÒÔʹÓá°ÖÐÏ¡±Êǽ«Python ÄÚºËÒ²ÖÐÎÄ»¯»¡Ò»¸öPython °æ±¾£»
Èç¹û½ö½öÏëÈñ༽çÃæÊ¹ÓÃÖÐÎĶøÒѵϰ£¬²Î¿¼¶ÅÐÖ½øÐеÄ
¶à×Ö½Ú×Ö·ûÖ§³Ö²¹³ä°ü
¶ÔÓÚ idle µÄÐÞÕý
/**
@class MBCSP-p223
for Python 2.2.3 (#42, May 30 2003, 18:12:08) [MSC 32 bit (Intel)] on win32
@brief MBCSPµÄ×÷ÓÃÊÇÓÃÓÚ ÈÈÐÞ(hotFix)python
ʹÆäÖ§³ÖÏÔʾ¶à×Ö½Ú×Ö·û£¬±ÈÈç¶«ÑǵØÇøµÄÎÄ×Ö¡£
Õâ¸ö°æ±¾Öв»Ö§³ÖÖÐÎıäÁ¿Ãû³Æ¡£
Õâ¸ö°æ±¾ÊÊÓÃÓÚWindows²Ù×÷ϵͳ¡£
@author Zoom.Quiet (zoomq at itcase.com)
@version 1.0 Zoomq::030626 ÔÚ
ÉçÎÄɽ(www.dohao.org),ÖÐÏ Glace(www.chinesepython.org) µÄÌáʾÏÂÍê³É
@par
@note [°²×°]
°Ñ´ËĿ¼ÖеÄÎļþ¸´ÖƵ½python 2.2.3 µÄ°²×°Ä¿Â¼Öм´¿É ¡£
@par
@note [ʵ¼ÊÐÞ¸Ä]
@li 1. python 2.2.3 µÄ°²×°Ä¿Â¼/Lib ÏÂÓÐÒ»¸ö site.py µÄµµ°¸, ±à¼µÚ 265 ÐÐ :
encoding = "ascii" # Default value set by _PyUnicode_Init()
±ä³É
#encoding = "ascii" # Default value set by _PyUnicode_Init()
encoding = "mbcs"
@li 2. python 2.2.3 µÄ°²×°Ä¿Â¼/Tools/idle/ ÏÂÐÞ¸ÄÕâËĸöµµ°¸:
@par CallTips.py: µÚ 55 ÐÐ: self.calltip.showtip(unicode(arg_text))
@par IoBinding.py: µÚ 98 ÐÐ: self.text.insert("1.0", unicode(chars))
@par OutputWindow.py µÚ 37 ÐÐ: self.text.insert(mark, unicode(str(s)), tags)
@par ToolTip.py: µÚ 50 ÐÐ: label = Label(self.tipwindow, text=unicode(text), justify=LEFT,
@attention DoxygenÓï·¨
±¾ËµÃ÷ʹÓÃDoxygen Óï·¨±êÇ©ÒÔ±ã¸ñʽÊä³ö
@par [ÓйØDoxygen]
www.doxygen.org
*/
ÒÔÉÏÊÇÎÒ·ÂÕյĶÔPython 2.2.3 µÄÐÞÕý£¬
ÄÇ䣬¿ÉÒÔ·´ÏòÍÆµ¼³öÄãµÄÉè¼ÆÖУ¬Ó¦¸ÃÓÐרÃŵÄÄÚ²¿×ª»»»úÖÆÀ´´¦Àí¹ú¼Ê±àÂ룡
¾ßÌåµÄ²Î¿¼ cnIDLE, flyEdit
dohao.org ÖÐÕÒÒ»ÏÂ×Ó£¡»¹ÓÐhttp://cosoft.org.cn/
Leo ¾ÍÍêȫʹÓà utf-8 À´Ö§³Ö¹ú¼ÊÂ룡
http://personalpages.tds.net/~edream/front.html
=== [ 18:14 ; 04-03-10 ] you wrote:
s> СµÜ³õѧ Python£¬ÎÒÔÚÓÃPYTHON ±àÒ»¸öNOTEPAD£¬¾ÍÊÇWINDOWS
s> ÄÇÖÖ£¬¶øÇÒÊÇÍêȫģ·ÂµÄ¡£Óм¸¸öÎÊÌâ¸é×Å£¬ÍøÉϲéÁ˺þã¬Ò»Ö±ÎÞ·¨½â¾ö¡£
s> 1¡¢ ¼ôÇаåÀï²Ù×÷¡£ clipboard_append(str)
s> ½«ÄÚÈÝËÍÈë¼ôÇа壬clipboard_clear£¨£©ÓÚÇå¿Õ£¬µ«Ôõôȡ³öÀïÃæµÄÄÚÈÝÄØ£¿£¨²»ÒªÐ¦ÎÒ£¬ÎÒȷʵÕÒ²»³öÀ´£©
s> 2¡¢ ¡°¹ØÓÚ¡±¶Ô»°¿ò£¬ os.sys.getwindowsversion()
s> ¿ÉÒԵõ½ÏµÍ³²¿·ÖÐÅÏ¢£¬µ«ÔõôµÃµ½ÏµÍ³µ±Ç°Óû§¡¢ÎïÀíÄÚ´æµÈÐÅÏ¢£¬Ïñ
s> windows notepad µÄ°ïÖúÄÇÑù¡£ÎÒÖ»ÊÇÏëºÜºÃµØÄ£·Â¡¢Êµ¼ùÖÐѧϰ python¡£
s> 3¡¢
s> ͨ¹ýŬÁ¦£¬¶Á¡¢Ð´¡¢Ð޸ĵȻù±¾¹¦ÄÜ¿ÉÒÔʵÏÖ¡£µ«·¢ÏÖ¶ÔÖÐÎÄÖ§³Ö²»¹»£¬ÓÐʲô°ì·¨£¿
s> лл¡£
=== === === === === === === === === ===
--
Best regards,
Zoom.Quiet
/=======================================\
]Time is unimportant, only life important![
\=======================================/
2004年03月11日 星期四 09:12
你用的是什么GUI?有没有用win32py? >From: "sherking" <sherking at citiz.net> >Reply-To: python-chinese at lists.python.cn >To: <python-chinese at lists.python.cn> >Subject: [python-chinese] Python 新手几个问题。 >Date: Wed, 10 Mar 2004 18:14:35 +0800 > >小弟初学 Python,我在用PYTHON 编一个NOTEPAD,就是WINDOWS 那种,而且是完全模 仿的。有几个问题搁着,网上查了好久,一直无法解决。 > >1、 剪切板里操作。 clipboard_append(str) 将内容送入剪切板,clipboard_clear ()于清空,但怎么取出里面的内容呢?(不要笑我,我确实找不出来) > >2、 “关于”对话框, os.sys.getwindowsversion() 可以得到系统部分信息,但怎 么得到系统当前用户、物理内存等信息,像 windows notepad 的帮助那样。我只是想 很好地模仿、实践中学习 python。 > >3、 通过努力,读、写、修改等基本功能可以实现。但发现对中文支持不够,有什么 办法? > >谢谢。 >_______________________________________________ >python-chinese list >python-chinese at lists.python.cn >http://python.cn/mailman/listinfo/python-chinese _________________________________________________________________ 免费下载 MSN Explorer: http://explorer.msn.com/lccn/
2004年03月11日 星期四 09:34
Hello Who,
如果使用 wxPython则 Clipboard 操作类似:
"""
def OnPaste(self, event):
do = wxTextDataObject()
wxTheClipboard.Open()
success = wxTheClipboard.GetData(do)
wxTheClipboard.Close()
if success:
pastedLines = LineSplitter(do.GetText())
else:
wxBell()
return
if len(pastedLines) == 0:
wxBell()
return
elif len(pastedLines) == 1:
self.SingleLineInsert(pastedLines[0])
else:
self.MultipleLinePaste(pastedLines)
"""
摘自\Lib\site-packages\wxPython\lib\editor\editor.py
你可以方便的使用 wxPython 打包好的全套 Clipboard 操作!
=== [ 9:12 ; 04-03-11 ] you wrote:
WB> 你用的是什么GUI?有没有用win32py?
>>From: "sherking" <sherking at citiz.net>
>>Reply-To: python-chinese at lists.python.cn
>>To: <python-chinese at lists.python.cn>
>>Subject: [python-chinese] Python 新手几个问题。
>>Date: Wed, 10 Mar 2004 18:14:35 +0800
>>
>>小弟初学 Python,我在用PYTHON 编一个NOTEPAD,就是WINDOWS 那种,而且是完全模
WB> 仿的。有几个问题搁着,网上查了好久,一直无法解决。
>>
>>1、 剪切板里操作。 clipboard_append(str)
>>将内容送入剪切板,clipboard_clear
WB> ()于清空,但怎么取出里面的内容呢?(不要笑我,我确实找不出来)
>>
>>2、 “关于”对话框, os.sys.getwindowsversion() 可以得到系统部分信息,但怎
WB> 么得到系统当前用户、物理内存等信息,像 windows notepad 的帮助那样。我只是想
WB> 很好地模仿、实践中学习 python。
>>
>>3、
>>通过努力,读、写、修改等基本功能可以实现。但发现对中文支持不够,有什么
WB> 办法?
>>
>>谢谢。
>>_______________________________________________
>>python-chinese list
>>python-chinese at lists.python.cn
>>http://python.cn/mailman/listinfo/python-chinese
WB> _________________________________________________________________
WB> 免费下载 MSN Explorer: http://explorer.msn.com/lccn/
WB> _______________________________________________
WB> python-chinese list
WB> python-chinese at lists.python.cn
WB> http://python.cn/mailman/listinfo/python-chinese
=== === === === === === === === === ===
--
Best regards,
Zoom.Quiet
/=======================================\
]Time is unimportant, only life important![
\=======================================/
2004年03月11日 星期四 09:40
如果sherking用的是Tkinter,那就只能用win32py来操作clipboard了。wxpython确实 好用,我现在一直都用它:-) >From: "Zoom.Quiet" <zoomq at infopro.cn> >Reply-To: "Zoom.Quiet" <zoomq at itcase.com;zoomq at infopro.cn> >To: "Who Bruce" <whoonline at msn.com> >CC: python-chinese at lists.python.cn >Subject: Re[2]: [python-chinese] Python 新手几个问题。 >Date: Thu, 11 Mar 2004 09:34:48 +0800 > >Hello Who, > >如果使用 wxPython则 Clipboard 操作类似: >""" >def OnPaste(self, event): > do = wxTextDataObject() > wxTheClipboard.Open() > success = wxTheClipboard.GetData(do) > wxTheClipboard.Close() > if success: > pastedLines = LineSplitter(do.GetText()) > else: > wxBell() > return > if len(pastedLines) == 0: > wxBell() > return > elif len(pastedLines) == 1: > self.SingleLineInsert(pastedLines[0]) > else: > self.MultipleLinePaste(pastedLines) >""" >摘自\Lib\site-packages\wxPython\lib\editor\editor.py >你可以方便的使用 wxPython 打包好的全套 Clipboard 操作! > > >=== [ 9:12 ; 04-03-11 ] you wrote: > >WB> 你用的是什么GUI?有没有用win32py? > > > >>From: "sherking" <sherking at citiz.net> > >>Reply-To: python-chinese at lists.python.cn > >>To: <python-chinese at lists.python.cn> > >>Subject: [python-chinese] Python 新手几个问题。 > >>Date: Wed, 10 Mar 2004 18:14:35 +0800 > >> > >>小弟初学 Python,我在用PYTHON 编一个NOTEPAD,就是WINDOWS 那种,而且是完 全模 >WB> 仿的。有几个问题搁着,网上查了好久,一直无法解决。 > >> > >>1、 剪切板里操作。 clipboard_append(str) > >>将内容送入剪切板,clipboard_clear >WB> ()于清空,但怎么取出里面的内容呢?(不要笑我,我确实找不出来) > >> > >>2、 “关于”对话框, os.sys.getwindowsversion() 可以得到系统部分信息,但 怎 >WB> 么得到系统当前用户、物理内存等信息,像 windows notepad 的帮助那样。我只 是想 >WB> 很好地模仿、实践中学习 python。 > >> > >>3、 > >>通过努力,读、写、修改等基本功能可以实现。但发现对中文支持不够,有什么 >WB> 办法? > >> > >>谢谢。 > >>_______________________________________________ > >>python-chinese list > >>python-chinese at lists.python.cn > >>http://python.cn/mailman/listinfo/python-chinese > >WB> _________________________________________________________________ >WB> 免费下载 MSN Explorer: http://explorer.msn.com/lccn/ > >WB> _______________________________________________ >WB> python-chinese list >WB> python-chinese at lists.python.cn >WB> http://python.cn/mailman/listinfo/python-chinese > >=== === === === === === === === === === > >-- >Best regards, > Zoom.Quiet > > /=======================================\ >]Time is unimportant, only life important![ > \=======================================/ > _________________________________________________________________ 与联机的朋友进行交流,请使用 MSN Messenger: http://messenger.msn.com/cn
2004年03月11日 星期四 10:28
python-chinese,您好!
请帮忙看看我的下述程序有什么问题,pt.txt是用
win2000的输入法生成器产生的输入法源文件,我想对其进行处
理后生成新的文件。可是现在连复制也做不到.
# -*- coding: cp936 -*-
oldfile=file("pt.txt","r")
newfile=file("ptz.txt","w")
lines=oldfile.readlines()
for line in lines:
newfile.write(line)
oldfile.close()
newfile.close()
致
礼!
0.706 at 163.com
2004-03-11
2004年03月11日 星期四 10:30
我记得是可以.请看Python for Delphi的文档。 ------- Explicit is better than implicit ... -----Original Message----- From: 0.706 [mailto:0.706 at 163.com] Sent: 2004年3月11日 10:33 To: python-chinese Subject: [python-chinese] (no subject) 各位好: 请问python for delphi 能在C++Build 下用吗? 致 礼! 0.706 0.706 at 163.com 2004-03-09
2004年03月11日 星期四 10:33
各位好: 请问python for delphi 能在C++Build 下用吗? 致 礼! 0.706 0.706 at 163.com 2004-03-09
2004年03月11日 星期四 10:34
python-chinese,您好!
请大家帮忙看看我的下述程序有什么问题,pt.txt是用
win2000的输入法生成器产生的输入法源文件,我想对其进行处
理后生成新的文件。可是现在连复制也做不到.
# -*- coding: cp936 -*-
oldfile=file("pt.txt","r")
newfile=file("ptz.txt","w")
lines=oldfile.readlines()
for line in lines:
newfile.write(line)
oldfile.close()
newfile.close()
致
礼!
0.706
0.706 at 163.com
2004-03-11
2004年03月11日 星期四 10:35
-----Original Message----- From: 0.706 [mailto:0.706 at 163.com] Sent: 2004年3月11日 10:34 To: python-chinese Subject: [python-chinese] (no subject) >python-chinese,您好! > 请大家帮忙看看我的下述程序有什么问题,pt.txt是用 >win2000的输入法生成器产生的输入法源文件,我想对其进行处 >理后生成新的文件。可是现在连复制也做不到. ># -*- coding: cp936 -*- >oldfile=file("pt.txt","r") >newfile=file("ptz.txt","w") >lines=oldfile.readlines() >for line in lines: > newfile.write(line) >oldfile.close() >newfile.close() 错在哪里?
2004年03月11日 星期四 10:39
Jacob Fan,您好! 那,请给我一份Python for Delphi好吗? ======= 2004-03-11 10:30:03 您在来信中写道:======= >我记得是可以.请看Python for Delphi的文档。 >------- >Explicit is better than implicit ... > >-----Original Message----- >From: 0.706 [mailto:0.706 at 163.com] >Sent: 2004年3月11日 10:33 >To: python-chinese >Subject: [python-chinese] (no subject) > > >各位好: > 请问python for delphi 能在C++Build 下用吗? > > > > 致 >礼! > > > 0.706 > 0.706 at 163.com > 2004-03-09 >_______________________________________________ >python-chinese list >python-chinese at lists.python.cn >http://python.cn/mailman/listinfo/python-chinese = = = = = = = = = = = = = = = = = = = = 致 礼! 0.706 0.706 at 163.com 2004-03-11
2004年03月11日 星期四 10:42
Whr Bruce, 你好。
我是 python 初学,用的确实是 Tkinter ,这几天用休息时间试试用 python 编个 notepad, 模仿 windows 的那个。实践是学习的最有效的途径。
我用 win32clipboard ,可以达到目的了。谢谢。
我全是靠网上的资料,主要是 http://www.pythonware.com/library/tkinter/introduction/index.htm上面的内容。 没有看到过 关于 win32clipboard 的之类的东西。本地目录也找不到源程序,只有 win32clipboard.pyd
可否指点一些在线帮助,这样查起来方便些。
----- Original Message -----
From: "Who Bruce" <whoonline at msn.com>
To: <python-chinese at lists.python.cn>
Sent: Thursday, March 11, 2004 9:40 AM
Subject: RE: Re[2]: [python-chinese] Python 新手几个问题。
> 如果sherking用的是Tkinter,那就只能用win32py来操作clipboard了。wxpython确实
> 好用,我现在一直都用它:-)
>
>
> >From: "Zoom.Quiet" <zoomq at infopro.cn>
> >Reply-To: "Zoom.Quiet" <zoomq at itcase.com;zoomq at infopro.cn>
> >To: "Who Bruce" <whoonline at msn.com>
> >CC: python-chinese at lists.python.cn
> >Subject: Re[2]: [python-chinese] Python 新手几个问题。
> >Date: Thu, 11 Mar 2004 09:34:48 +0800
> >
> >Hello Who,
> >
> >如果使用 wxPython则 Clipboard 操作类似:
> >"""
> >def OnPaste(self, event):
> > do = wxTextDataObject()
> > wxTheClipboard.Open()
> > success = wxTheClipboard.GetData(do)
> > wxTheClipboard.Close()
> > if success:
> > pastedLines = LineSplitter(do.GetText())
> > else:
> > wxBell()
> > return
> > if len(pastedLines) == 0:
> > wxBell()
> > return
> > elif len(pastedLines) == 1:
> > self.SingleLineInsert(pastedLines[0])
> > else:
> > self.MultipleLinePaste(pastedLines)
> >"""
> >摘自\Lib\site-packages\wxPython\lib\editor\editor.py
> >你可以方便的使用 wxPython 打包好的全套 Clipboard 操作!
> >
> >
> >=== [ 9:12 ; 04-03-11 ] you wrote:
> >
> >WB> 你用的是什么GUI?有没有用win32py?
> >
> >
> > >>From: "sherking" <sherking at citiz.net>
> > >>Reply-To: python-chinese at lists.python.cn
> > >>To: <python-chinese at lists.python.cn>
> > >>Subject: [python-chinese] Python 新手几个问题。
> > >>Date: Wed, 10 Mar 2004 18:14:35 +0800
> > >>
> > >>小弟初学 Python,我在用PYTHON 编一个NOTEPAD,就是WINDOWS 那种,而且是完
> 全模
> >WB> 仿的。有几个问题搁着,网上查了好久,一直无法解决。
> > >>
> > >>1、 剪切板里操作。 clipboard_append(str)
> > >>将内容送入剪切板,clipboard_clear
> >WB> ()于清空,但怎么取出里面的内容呢?(不要笑我,我确实找不出来)
> > >>
> > >>2、 “关于”对话框, os.sys.getwindowsversion() 可以得到系统部分信息,但
> 怎
> >WB> 么得到系统当前用户、物理内存等信息,像 windows notepad 的帮助那样。我只
> 是想
> >WB> 很好地模仿、实践中学习 python。
> > >>
> > >>3、
> > >>通过努力,读、写、修改等基本功能可以实现。但发现对中文支持不够,有什么
> >WB> 办法?
> > >>
> > >>谢谢。
> > >>_______________________________________________
> > >>python-chinese list
> > >>python-chinese at lists.python.cn
> > >>http://python.cn/mailman/listinfo/python-chinese
> >
> >WB> _________________________________________________________________
> >WB> 免费下载 MSN Explorer: http://explorer.msn.com/lccn/
> >
> >WB> _______________________________________________
> >WB> python-chinese list
> >WB> python-chinese at lists.python.cn
> >WB> http://python.cn/mailman/listinfo/python-chinese
> >
> >=== === === === === === === === === ===
> >
> >--
> >Best regards,
> > Zoom.Quiet
> >
> > /=======================================\
> >]Time is unimportant, only life important![
> > \=======================================/
> >
>
> _________________________________________________________________
> 与联机的朋友进行交流,请使用 MSN Messenger: http://messenger.msn.com/cn
>
> _______________________________________________
> python-chinese list
> python-chinese at lists.python.cn
> http://python.cn/mailman/listinfo/python-chinese
>
2004年03月12日 星期五 01:00
请问,你使用unicode吗?我的经验是,用unicode的wxPython, paste中文不对。你有什么经验? > 如果使用 wxPython则 Clipboard 操作类似: > """ > def OnPaste(self, event): > do = wxTextDataObject() > wxTheClipboard.Open() > success = wxTheClipboard.GetData(do) > wxTheClipboard.Close() > if success: > pastedLines = LineSplitter(do.GetText()) > else: > wxBell() > return > if len(pastedLines) == 0: > wxBell() > return > elif len(pastedLines) == 1: > self.SingleLineInsert(pastedLines[0]) > else: > self.MultipleLinePaste(pastedLines) > """ >
2004年03月12日 星期五 01:05
可以看: http://www.linuxquestions.org/questions/archive/9/2004/01/1/130687 http://www.faqts.com/knowledge_base/view.phtml/aid/4668 http://mail.python.org/pipermail/python-list/2003-March/151611.html > > Whr Bruce, 你好。 > 我是 python 初学,用的确实是 Tkinter ,这几天用休息时间试试用 > python 编个 notepad, 模仿 windows 的那个。实践是学习的最有效的途径。 > > 我用 win32clipboard ,可以达到目的了。谢谢。 > > 我全是靠网上的资料,主要是 > http://www.pythonware.com/library/tkinter/introduction/index.htm上面的 > 内容。 没有看到过 关于 win32clipboard 的之类的东西。本地目录也找不到源 > 程序,只有 win32clipboard.pyd > > 可否指点一些在线帮助,这样查起来方便些。 > > ----- Original Message ----- > From: "Who Bruce" <whoonline at msn.com> > To: <python-chinese at lists.python.cn> > Sent: Thursday, March 11, 2004 9:40 AM > Subject: RE: Re[2]: [python-chinese] Python 新手几个问题。 > > > > 如果sherking用的是Tkinter,那就只能用win32py来操作clipboard了。 > wxpython确实 > > 好用,我现在一直都用它:-) > > > > > > >From: "Zoom.Quiet" <zoomq at infopro.cn> > > >Reply-To: "Zoom.Quiet" <zoomq at itcase.com;zoomq at infopro.cn> > > >To: "Who Bruce" <whoonline at msn.com> > > >CC: python-chinese at lists.python.cn > > >Subject: Re[2]: [python-chinese] Python 新手几个问题。 > > >Date: Thu, 11 Mar 2004 09:34:48 +0800 > > > > > >Hello Who, > > > > > >如果使用 wxPython则 Clipboard 操作类似: > > >""" > > >def OnPaste(self, event): > > > do = wxTextDataObject() > > > wxTheClipboard.Open() > > > success = wxTheClipboard.GetData(do) > > > wxTheClipboard.Close() > > > if success: > > > pastedLines = LineSplitter(do.GetText()) > > > else: > > > wxBell() > > > return > > > if len(pastedLines) == 0: > > > wxBell() > > > return > > > elif len(pastedLines) == 1: > > > self.SingleLineInsert(pastedLines[0]) > > > else: > > > self.MultipleLinePaste(pastedLines) > > >""" > > >摘自\Lib\site-packages\wxPython\lib\editor\editor.py > > >你可以方便的使用 wxPython 打包好的全套 Clipboard 操作! > > > > > > > > >=== [ 9:12 ; 04-03-11 ] you wrote: > > > > > >WB> 你用的是什么GUI?有没有用win32py? > > > > > > > > > >>From: "sherking" <sherking at citiz.net> > > > >>Reply-To: python-chinese at lists.python.cn > > > >>To: <python-chinese at lists.python.cn> > > > >>Subject: [python-chinese] Python 新手几个问题。 > > > >>Date: Wed, 10 Mar 2004 18:14:35 +0800 > > > >> > > > >>小弟初学 Python,我在用PYTHON 编一个NOTEPAD,就是WINDOWS 那种, 而 > 且是完 > > 全模 > > >WB> 仿的。有几个问题搁着,网上查了好久,一直无法解决。 > > > >> > > > >>1、 剪切板里操作。 clipboard_append(str) > > > >>将内容送入剪切板,clipboard_clear > > >WB> ()于清空,但怎么取出里面的内容呢?(不要笑我,我确实找不出 来) > > > >> > > > >>2、 “关于”对话框, os.sys.getwindowsversion() 可以得到系统部分 > 信息,但 > > 怎 > > >WB> 么得到系统当前用户、物理内存等信息,像 windows notepad 的帮助那 > 样。我只 > > 是想 > > >WB> 很好地模仿、实践中学习 python。 > > > >> > > > >>3、 > > > >>通过努力,读、写、修改等基本功能可以实现。但发现对中文支持不够, > 有什么 > > >WB> 办法? > > > >> > > > >>谢谢。
2004年03月12日 星期五 08:28
Hello John, sorry 在下只有理论,没有具体实践过, 不过从使用过的几种Python 开发的编辑工具来看, 编辑容器一定要是utf-8 的才容易兼容中文的, paste 不回去,就因为容器不识别吧! === [ 1:00 ; 04-03-12 ] you wrote: JL> 请问,你使用unicode吗?我的经验是,用unicode的wxPython, JL> paste中文不对。你有什么经验? >> 如果使用 wxPython则 Clipboard 操作类似: >> """ >> def OnPaste(self, event): >> do = wxTextDataObject() >> wxTheClipboard.Open() >> success = wxTheClipboard.GetData(do) >> wxTheClipboard.Close() >> if success: >> pastedLines = LineSplitter(do.GetText()) >> else: >> wxBell() >> return >> if len(pastedLines) == 0: >> wxBell() >> return >> elif len(pastedLines) == 1: >> self.SingleLineInsert(pastedLines[0]) >> else: >> self.MultipleLinePaste(pastedLines) >> """ >> JL> _______________________________________________ JL> python-chinese list JL> python-chinese at lists.python.cn JL> http://python.cn/mailman/listinfo/python-chinese === === === === === === === === === === -- Best regards, Zoom.Quiet /=======================================\ ]Time is unimportant, only life important![ \=======================================/
Zeuux © 2025
京ICP备05028076号