回答此问题可获得 20 贡献值,回答如果被采纳可获得 50 分。
<p>在下面的代码中,如何从类<code>Acceptor</code>调用方法<code>bio_info</code>?你知道吗</p>
<pre><code>import sys
import Tkinter
from Tkinter import *
from tkMessageBox import *
from tkSimpleDialog import *
class Acceptor():
def bio_info(self):
#this method takes in input from the keyboard console
def__init__(self,name,mat_no,semester)
self.name=name
self.mat_no=mat_no
self.semester=semester
Label(top,text='Name').grid(row=0)
Label(top,text='Matric No').grid(row=1)
Label(top,text='Semester').grid(row=2)
name=Entry(top)
mat_no=Entry(top)
semester=Entry(top)
name.grid(row=0,column=1)
mat_no.grid(row=1,column=1)
semester.grid(row=2,column=1)
return name
return mat_no
return semester
main = Tk()
#This defines the size of the main window
main.geometry('640x480')
#This takes care of the configuration of the main window, buttons and labels inclusive
main.title('Result Calculator App')
mainLabel=Tkinter.Label(main,text='Result Calculator',bd=10, relief=RIDGE,fg='cyan')
mainLabel.pack(fill=BOTH)
mainLabel.config(font=('algerian',35, 'bold'), bg='blue',fg='orange')
calculate=Button(text="CALCULATE",font=('joan',20,'bold'),bg='black',fg='green',width=15,cursor='hand2',relief=SOLID,
command=Acceptor.bio_info)
calculate.pack()
print'This program ran correctly'
main.mainloop()
</code></pre>