2005年04月08日 星期五 14:53
Programming Python第七章在讲解Scale的例子7-30里有这样一段代码: *Scale(self, label='Pick demo number', command=self.onMove, variable=self.var,* * from_=0, to=len(demos)-1).pack()* 其中为command对应的函数是: *def onMove(self, value): print 'in onMove', value *value应该是对应Scale当前的值,可它是从哪儿蹦出来的呢? 看了半天想不明白,各位高手帮忙解答一下?thx,^_^ -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20050408/f281d062/attachment.html
2005年04月08日 星期五 15:52
应该是由tkinter自动传给你的。一般事件处理方法都需要接收一个event参数,这个参数是由事件管理器管理,事件的处理方法也是由事件管理器来调用的,它会把事件参数传给处理方法。这是我的理解。 On Apr 8, 2005 2:53 PM, SS Ringster <cvx.zero at gmail.com> wrote: > Programming Python第七章在讲解Scale的例子7-30里有这样一段代码: > Scale(self, label='Pick demo number', > command=self.onMove, > variable=self.var, > from_=0, to=len(demos)-1).pack() > 其中为command对应的函数是: > def onMove(self, value): > print 'in onMove', value > value应该是对应Scale当前的值,可它是从哪儿蹦出来的呢? > 看了半天想不明白,各位高手帮忙解答一下?thx,^_^ > _______________________________________________ > python-chinese list > python-chinese at lists.python.cn > http://python.cn/mailman/listinfo/python-chinese > > > -- I like python! My Donews Blog: http://www.donews.net/limodou My Sina Blog: http://blog.sina.com.cn/blog/1148608914 New Google Maillist: http://groups-beta.google.com/group/python-cn
2005年04月08日 星期五 16:14
python-chinese我的系统是windows XP SP2、sun J2se 1.4.2.07、Jython 2.1 --------------------------------------------------------------------------------- C:\jython21\Demo\applet>c:\jython21\jythonc --core --deep --jar appletdemo.jar * .py processing ButtonDemo processing pawt.__init__ processing ButtonFontDemo processing CheckboxDemo processing ChoiceDemo processing Converter processing CoordinatesDemo processing HelloApplet processing HelloWorld processing LabelDemo processing ListDemo Required packages: java.applet java.awt.event Creating adapters: java.awt.event.WindowListener used in __init__ java.awt.event.ItemListener used in ChoiceDemo, ListDemo java.awt.event.ActionListener used in ButtonDemo, ButtonFontDemo, ListDemo java.awt.event.MouseListener used in CoordinatesDemo Creating .java files: HelloWorld module HelloWorld extends java.applet.Applet ButtonFontDemo module ButtonFontDemo extends java.applet.Applet HelloApplet module HelloApplet extends java.applet.Applet __init__ module ButtonDemo module ButtonDemo extends java.applet.Applet LabelDemo module LabelDemo extends java.applet.Applet CheckboxDemo module CheckboxDemo extends java.applet.Applet ChoiceDemo module ChoiceDemo extends java.applet.Applet ListDemo module ListDemo extends java.applet.Applet Converter module ConversionPanel extends java.awt.Panel implements java.awt.event.ActionListe ner, java.awt.event.AdjustmentListener, java.awt.event.ItemListener Converter extends java.applet.Applet CoordinatesDemo module CoordinateArea extends java.awt.Canvas FramedArea extends java.awt.Panel CoordinatesDemo extends java.applet.Applet Compiling .java to .class... Compiling with args: ['C:\\Program Files\\Java\\j2re1.4.2_07\\bin\\javac', '-cla sspath', 'C:\\jython21\\jython.jar;;.\\jpywork;;C:\\jython21\\Tools\\jythonc;C:\ \jython21\\Demo\\applet\\.;C:\\jython21\\Lib;C:\\jython21', '.\\jpywork\\HelloWo rld.java', '.\\jpywork\\ButtonFontDemo.java', '.\\jpywork\\HelloApplet.java', '. \\jpywork\\pawt\\__init__.java', '.\\jpywork\\ButtonDemo.java', '.\\jpywork\\Lab elDemo.java', '.\\jpywork\\CheckboxDemo.java', '.\\jpywork\\ChoiceDemo.java', '. \\jpywork\\ListDemo.java', '.\\jpywork\\Converter.java', '.\\jpywork\\Coordinate sDemo.java'] 1 java.io.IOException: CreateProcess: "C:\Program Files\Java\j2re1.4.2_07\bin\j avac" -classpath C:\jython21\jython.jar;;.\jpywork;;C:\jython21\Tools\jythonc;C: \jython21\Demo\applet\.;C:\jython21\Lib;C:\jython21 .\jpywork\HelloWorld.java .\ jpywork\ButtonFontDemo.java .\jpywork\HelloApplet.java .\jpywork\pawt\__init__.j ava .\jpywork\ButtonDemo.java .\jpywork\LabelDemo.java .\jpywork\CheckboxDemo.ja va .\jpywork\ChoiceDemo.java .\jpywork\ListDemo.java .\jpywork\Converter.java .\ jpywork\CoordinatesDemo.java error=2 Consider using the -C/--compiler command line switch, or setting the property python.jythonc.compiler in the registry. ERROR DURING JAVA COMPILATION... EXITING C:\jython21\Demo\applet> --------------------------------------------------------------------------------- 这是为什么? python_user python_user at yahoo.com.cn 2005-04-08
Zeuux © 2025
京ICP备05028076号