2007年12月13日 星期四 14:10
ÖÕÓÚ¸ã³öÀ´ÁË¡£ÇëÐмҶà¶àÖ¸µã¡£
»¹Óм¸¸öÎÊÌ⣬²»ÖªµÀÔõôÔÚGUIÏÂÃæ¼Ó±³¾°Í¼Æ¬£¬»¹ÓÐÈçºÎÔÚpythonϼÓÈëÖÐÎÄ¡£ÎÒһдÖÐÎľÍÂÒÂë¡£
·³ÇëÖªµÀÕß²»ÁßÖ¸½Ì¡£Ð»Ð»
# -*- coding: cp936 -*-
###This program is to calculate RP
###Written by He, Jibo(UIUC) for GUI and for fun
from Tkinter import *
from tkMessageBox import *
from string import *
class LabelDemo(Frame):
"""demonstrate labels"""
def __init__(self):
"""create three labels and pack them"""
Frame.__init__(self) #initializes frame object
# frame fills all available space
self.pack(expand=YES,fill=BOTH)
self.master.title("RP Calculator")
self.master.geometry("325x200+100+100")
self.Label_title=Label(self,text="RP Calculator",font=22)
#resize frame to accommodate label
self.Label_title.pack(pady=20)
self.Label_author=Label(self,text="He,Jibo (UIUC)")
self.Label_author.pack(side=TOP)
## name entry
self.frame1=Frame(self)
self.frame1.pack()
self.entry_Name=Entry(self.frame1,name="entry_Name")
self.entry_Name.insert(INSERT,"Enter Name here")
self.entry_Name.bind("",self.RP)
self.entry_Name.pack(side=LEFT,pady=5)
def RP(self,event):
"""calculate and display the RP"""
Entry=event.widget.winfo_name()
Name=event.widget.get()
rp = 0
for i in Name:
rp+=ord(i)
rp%=100
if Name=="hejibo": rp=100
showinfo("Message","Your RP is:"+str(rp))
def main():
LabelDemo().mainloop() #starts event loop
if __name__=="__main__":
main()
--
Best Regards,
He Jibo
jibohe2在cyrus.psych.uiuc.edu
hejibo在gmail.com
---------------------------
He Jibo
Department of Psychology,
Beckman Institute for Advanced Science and Technology
University of Illinois, Urbana Champaign,
603 East Daniel St.,
Champaign, IL 61820
Tel: 217-244-4461(office)
217-244-6763(lab)
Email: hejibo在gmail.com
-------------- 下一部分 --------------
Ò»¸öHTML¸½¼þ±»ÒƳý...
URL: http://python.cn/pipermail/python-chinese/attachments/20071213/ca083412/attachment.htm
2007年12月13日 星期四 14:17
好有趣的创意。 乱弹一下:为何不用wxpython 中文的问题估计是文件本身的字符集不符。 在07-12-13,He Jibo <hejibo在gmail.com> 写道: > > 终于搞出来了。请行家多多指点。 > > 还有几个问题,不知道怎么在GUI下面加背景图片,还有如何在python下加入中文。我一写中文就乱码。 > -------------- 下一部分 -------------- 一个HTML附件被移除... URL: http://python.cn/pipermail/python-chinese/attachments/20071213/cd714dad/attachment.html
2007年12月13日 星期四 14:18
Tk很完善,但是Tkinter很简陋,估计加背景图有些困难。 至于中文,你全部用unicode字符串就好了。也就是所有的字符串都是astr=u"中文"这种。
2007年12月13日 星期四 14:34
wxpython¿ÉÒÔ¼Ó±³¾°Í¼Â𣿠ÎÒÊÔÊÔ¡£Ð»Ð»Ö¸µã On Dec 13, 2007 12:18 AM, doudou doudou <array.doudou在gmail.com> wrote: > TkºÜÍêÉÆ£¬µ«ÊÇTkinterºÜ¼òª£¬¹À¼Æ¼Ó±³¾°Í¼ÓÐЩÀ§ÄÑ¡£ > > ÖÁÓÚÖÐÎÄ£¬ÄãÈ«²¿ÓÃunicode×Ö·û´®¾ÍºÃÁË¡£Ò²¾ÍÊÇËùÓеÄ×Ö·û´®¶¼ÊÇastr=u"ÖÐÎÄ"ÕâÖÖ¡£ > _______________________________________________ > python-chinese > Post: send python-chinese在lists.python.cn > Subscribe: send subscribe to python-chinese-request在lists.python.cn > Unsubscribe: send unsubscribe to python-chinese-request在lists.python.cn > Detail Info: http://python.cn/mailman/listinfo/python-chinese -- Best Regards, He Jibo jibohe2在cyrus.psych.uiuc.edu hejibo在gmail.com --------------------------- He Jibo Department of Psychology, Beckman Institute for Advanced Science and Technology University of Illinois, Urbana Champaign, 603 East Daniel St., Champaign, IL 61820 Tel: 217-244-4461(office) 217-244-6763(lab) Email: hejibo在gmail.com -------------- 下一部分 -------------- Ò»¸öHTML¸½¼þ±»ÒƳý... URL: http://python.cn/pipermail/python-chinese/attachments/20071213/7dfbcf95/attachment.htm
2007年12月14日 星期五 21:28
for i in xrange(10000):
print "要写unicode('中文','utf8')这种...或者u'\u4e2d\u6587'"
在 07-12-13,He Jibo<hejibo在gmail.com> 写道:
> wxpython可以加背景图吗?
> 我试试。谢谢指点
>
>
> On Dec 13, 2007 12:18 AM, doudou doudou <array.doudou在gmail.com> wrote:
>
> > Tk很完善,但是Tkinter很简陋,估计加背景图有些困难。
> >
> > 至于中文,你全部用unicode字符串就好了。也就是所有的字符串都是astr=u"中文"这种。
> > _______________________________________________
> > python-chinese
> > Post: send python-chinese在lists.python.cn
> > Subscribe: send subscribe to
> python-chinese-request在lists.python.cn
> > Unsubscribe: send unsubscribe to
> python-chinese-request在lists.python.cn
> > Detail Info:
> http://python.cn/mailman/listinfo/python-chinese
>
>
>
> --
> Best Regards,
>
> He Jibo
> jibohe2在cyrus.psych.uiuc.edu
> hejibo在gmail.com
>
>
> ---------------------------
> He Jibo
> Department of Psychology,
> Beckman Institute for Advanced Science and Technology
> University of Illinois, Urbana Champaign,
> 603 East Daniel St.,
> Champaign, IL 61820
> Tel: 217-244-4461(office)
> 217-244-6763(lab)
> Email: hejibo在gmail.com
> _______________________________________________
> python-chinese
> Post: send python-chinese在lists.python.cn
> Subscribe: send subscribe to
> python-chinese-request在lists.python.cn
> Unsubscribe: send unsubscribe to
> python-chinese-request在lists.python.cn
> Detail Info:
> http://python.cn/mailman/listinfo/python-chinese
>
2007年12月15日 星期六 00:25
ÇëÎÊÔõô֪µÀÒ»¸öºº×ÖµÄunicodeÄØ£¿Ð»Ð» On Dec 14, 2007 7:28 AM, yuting cui <yutingcui在gmail.com> wrote: > for i in xrange(10000): > print "Ҫдunicode('ÖÐÎÄ','utf8')ÕâÖÖ...»òÕßu'\u4e2d\u6587'" > > ÔÚ 07-12-13£¬He Jibo<hejibo在gmail.com> дµÀ£º > > wxpython¿ÉÒÔ¼Ó±³¾°Í¼Â𣿠> > ÎÒÊÔÊÔ¡£Ð»Ð»Ö¸µã > > > > > > On Dec 13, 2007 12:18 AM, doudou doudou <array.doudou在gmail.com> wrote: > > > > > TkºÜÍêÉÆ£¬µ«ÊÇTkinterºÜ¼òª£¬¹À¼Æ¼Ó±³¾°Í¼ÓÐЩÀ§ÄÑ¡£ > > > > > > ÖÁÓÚÖÐÎÄ£¬ÄãÈ«²¿ÓÃunicode×Ö·û´®¾ÍºÃÁË¡£Ò²¾ÍÊÇËùÓеÄ×Ö·û´®¶¼ÊÇastr=u"ÖÐÎÄ"ÕâÖÖ¡£ > > > _______________________________________________ > > > python-chinese > > > Post: send python-chinese在lists.python.cn > > > Subscribe: send subscribe to > > python-chinese-request在lists.python.cn > > > Unsubscribe: send unsubscribe to > > python-chinese-request在lists.python.cn > > > Detail Info: > > http://python.cn/mailman/listinfo/python-chinese > > > > > > > > -- > > Best Regards, > > > > He Jibo > > jibohe2在cyrus.psych.uiuc.edu > > hejibo在gmail.com > > > > > > --------------------------- > > He Jibo > > Department of Psychology, > > Beckman Institute for Advanced Science and Technology > > University of Illinois, Urbana Champaign, > > 603 East Daniel St., > > Champaign, IL 61820 > > Tel: 217-244-4461(office) > > 217-244-6763(lab) > > Email: hejibo在gmail.com > > _______________________________________________ > > python-chinese > > Post: send python-chinese在lists.python.cn > > Subscribe: send subscribe to > > python-chinese-request在lists.python.cn > > Unsubscribe: send unsubscribe to > > python-chinese-request在lists.python.cn > > Detail Info: > > http://python.cn/mailman/listinfo/python-chinese > > > _______________________________________________ > python-chinese > Post: send python-chinese在lists.python.cn > Subscribe: send subscribe to python-chinese-request在lists.python.cn > Unsubscribe: send unsubscribe to python-chinese-request在lists.python.cn > Detail Info: http://python.cn/mailman/listinfo/python-chinese > -- Best Regards, He Jibo jibohe2在cyrus.psych.uiuc.edu hejibo在gmail.com --------------------------- He Jibo Department of Psychology, Beckman Institute for Advanced Science and Technology University of Illinois, Urbana Champaign, 603 East Daniel St., Champaign, IL 61820 Tel: 217-244-4461(office) 217-244-6763(lab) Email: hejibo在gmail.com -------------- 下一部分 -------------- Ò»¸öHTML¸½¼þ±»ÒƳý... URL: http://python.cn/pipermail/python-chinese/attachments/20071214/491a73f7/attachment.htm
Zeuux © 2025
京ICP备05028076号