<DIV>Hi,<BR> Iam using python and tkinter. My program run number<BR>of lines. To increase the maintainablity i divided my<BR>program in to two modules (ie, 2 python programs) and<BR>imported them at needed place.<BR> <BR> My first program called "a.py" is the main program<BR>in which i placed a button. When u click the button a<BR>dialogbox which is defined in "b.py" will be poped up.<BR>The dialog box contains two entry widgets. Now the<BR>problem is i want to set some default values for the<BR>entry widgets when they displayed. I defined 2 <BR>variables called "name" ,"eno" in "a.py" and want to<BR>assign their values to corresponding entry widgets.<BR>When i run the program i got the following error:</DIV>
<DIV> File "a.py" line 12, in ?<BR> import b<BR> File "b.py" line 4<BR> from import a <BR> <BR>My program is given below.</DIV>
<DIV>##########################################<BR>############# a.py<BR>##########################################</DIV>
<DIV>from Tkinter import *<BR>import b</DIV>
<DIV>class App:<BR> def __init__(self,parent):<BR> self.myparent = parent<BR> Button(self.myparent,text="Click",width=10,<BR>height=10,command=self.showdlg).pack()<BR> self.name = "AAAAA"<BR> self.no = 100</DIV>
<DIV> def showdlg(self):<BR> b.MyDialog(self.myparent)</DIV>
<DIV>root = Tk()<BR>myapp = App(root)<BR>root.mainloop()</DIV>
<DIV>##########################################<BR>############# b.py<BR>##########################################</DIV>
<DIV>import tkMessageBox<BR>import tkSimpleDialog<BR>from Tkinter import *<BR>import a<BR>import string</DIV>
<DIV>class MyDialog(tkSimpleDialog.Dialog):</DIV>
<DIV> def body(self, master):</DIV>
<DIV> Label(master, text="First:").grid(row=0)<BR> Label(master, text="Second:").grid(row=1)</DIV>
<DIV> self.e1 = Entry(master)<BR> self.e2 = Entry(master)</DIV>
<DIV> self.e1.grid(row=0, column=1)<BR> self.e2.grid(row=1, column=1)<BR> self.e1.insert(0,a.myapp.name)<BR> self.e2.insert(0,a.myapp.no)</DIV>
<DIV> def apply(self):</DIV>
<DIV> first = (self.e1.get()) #string.atoi<BR> second = string.atoi(self.e2.get())<BR> print first, second # or something</DIV>
<DIV> Let me know where i gone wrong and correct my<BR>mistake.</DIV>
<DIV>Thanx</DIV>
<DIV> </DIV><p><hr SIZE=1>
Do you Yahoo!?<br>
<a href="http://us.rd.yahoo.com/search/mailsig/*http://search.yahoo.com">The New Yahoo! Search</a> - Faster. Easier. Bingo.