Wind River Support Network

HomeDefectsLIN1018-1659
Fixed

LIN1018-1659 : python tkinter is not working

Created: Jul 2, 2018    Updated: Mar 7, 2019
Resolved Date: Dec 9, 2018
Found In Version: unknown
Fix Version: 10.18.44.2
Severity: Standard
Applicable for: Wind River Linux LTS 18
Component/s: Userspace

Description

root@intel-x86-64:~# python
Python 2.7.13 (default, Jun 13 2018, 02:59:13)
[GCC 7.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import Tkinter
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib64/python2.7/lib-tk/Tkinter.py", line 39, in <module>
    import _tkinter # If this fails your Python may not be configured for Tk
ImportError: No module named _tkinter
>>>

Workaround

in local.conf
PNWHITELIST_openembedded-layer += ' tk cdrkit'

in oe-core layer
./meta/recipes-devtools/python/python-2.7-manifest.inc
-RDEPENDS_${PN}-tkinter="${PN}-core"
+RDEPENDS_${PN}-tkinter="${PN}-core tk"

rebuild python

you'll get tmp-glibc/work/corei7-64-wrs-linux/python/2.7.13-r1/packages-split/python-tkinter/usr/lib64/python2.7/lib-dynload/_tkinter.so

scp it to target directory /usr/lib64/python2.7/lib-dynload/

please note. this workaround is incomplete, since you will endup failing if you try to build target image 

Steps to Reproduce

--machines intel-x86-64 --dl-layers --distro wrlinux-std-sato 
bitbake wrlinux-image-glibc-std-sato 

on target run 
#python
#import Tkinter 
on target run 
#python
#import Tkinter 
Live chat
Online