How can I get Tkinter to work in Python? (I tried many things)

tomzam at gmail.com tomzam at gmail.com
Mon Apr 27 20:49:26 EDT 2009


	I am trying to get Tkinter to work with my Python build.
	I've scoured usenet(comp.lang.Python) and google and there's
information that's helpful but I just can't seam to get it completely
right. I tried many of the suggestion, but nothing seems to work
	My setup is Fedora Core 6 [my yum is also broken. (sigh. yes, I know
I should upgrade)]
	I've download Tcl/Tk from Active State and installed it here:
/usr/ActiveTcl-8.5
	My python to build is in this directory:
/home/tomzam/mylib6/Python-2.6.2
	I removed the comment symbol (#)  from the line:
	  _tkinter _tkinter.c tkappinit.c -DWITH_APPINIT \
in the Modules/Setup
so the lines in the Setup file look like this:

# *** Always uncomment this (leave the leading underscore in!):
  _tkinter _tkinter.c tkappinit.c -DWITH_APPINIT \
# *** Uncomment and edit to reflect where your Tcl/Tk libraries are:
        -L/usr/ActiveTcl-8.5/lib/tk8.5 \
# *** Uncomment and edit to reflect where your Tcl/Tk headers are:
        -I/usr/ActiveTcl-8.5/include/tcl8.5 \
	when I run ./configure in /home/tomzam/mylib6/Python-2.6.2 everything
looks
right but then I try running  make in /home/tomzam/mylib6/Python-2.6.2

There are errors, but since there is many of them:
here is a cut out of the _tkinter errors:

libpython2.6.a(_tkinter.o): In function `Tkapp_CallProc':
/home/tomzam/mylib6/Python-2.6.2/./Modules/_tkinter.c:1263: undefined
reference to `Tcl_MutexLock'
/home/tomzam/mylib6/Python-2.6.2/./Modules/_tkinter.c:1264: undefined
reference to `Tcl_ConditionNotify'
/home/tomzam/mylib6/Python-2.6.2/./Modules/_tkinter.c:1265: undefined
reference to `Tcl_MutexUnlock'
/home/tomzam/mylib6/Python-2.6.2/./Modules/_tkinter.c:1251: undefined
reference to `Tcl_GetStringResult'
libpython2.6.a(_tkinter.o): In function `Tkapp_CallDeallocArgs':
/home/tomzam/mylib6/Python-2.6.2/./Modules/_tkinter.c:1123: undefined
reference to `Tcl_Free'
libpython2.6.a(tkappinit.o): In function `Tcl_AppInit':
/home/tomzam/mylib6/Python-2.6.2/./Modules/tkappinit.c:48: undefined
reference to `Tcl_Init'
/home/tomzam/mylib6/Python-2.6.2/./Modules/tkappinit.c:77: undefined
reference to `Tcl_GetVar'
/home/tomzam/mylib6/Python-2.6.2/./Modules/tkappinit.c:81: undefined
reference to `Tk_Init'
/home/tomzam/mylib6/Python-2.6.2/./Modules/tkappinit.c:84: undefined
reference to `Tk_MainWindow'
/home/tomzam/mylib6/Python-2.6.2/./Modules/tkappinit.c:81: undefined
reference to `Tk_Init'
collect2: ld returned 1 exit status
make: *** [python] Error 1

But since they are all undefined references - I feel I'm pretty close
to a solution.

Can you help me the rest of the way?
I'm trying to make tkinter work with my local Python install,
 any help will be appreciated!

Thank in advance,
	-Tom Z



More information about the Python-list mailing list