WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Displaying image using python  (Read 1636 times)

Offline Chau

  • Newbie
  • *
  • Posts: 20
Displaying image using python
« on: September 19, 2017, 09:48:01 AM »
I have read somewhere that tkinter can be used to display an image on the screen, which is what I would like to do. I have loaded python but I cannot seem to find any recent reference to tkinter in the forum.

How can I load/install tkinter in my piCore 9.x?

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11213
Re: Displaying image using python
« Reply #1 on: September 19, 2017, 10:02:20 AM »
Hi Chau
From  http://tinycorelinux.net/9.x/armv6/tcz/python.tcz.info:
Quote
Title:          python.tcz
Description:    Python programming language
Version:        2.7.13
Author:         Python Software Foundation
Original-site:  http://www.python.org
Copying-policy: Python license, http://www.python.org/psg/license
Size:           10.2M
Extension_by:   bmarkus
Tags:           DEVELOPMENT PROGRAMMING CLI PYTHON
Comments:       Binaries only
                ----
                Soft dependency: tk, tcl
                Install it if you need Tkinter

                ----
                Compiled for piCore 8.x
Change-log:     2016/05/18 First version, 2.7.11
                2016/07/02 Updated to 2.7.12
                2016/08/28 Rebuilt with tcltk 8.6
Current:        2016/12/23 Updated to 2.7.13
Installing  tk.tcz  will pull in  tcl.tcz  as one of its dependencies.

From  http://tinycorelinux.net/9.x/armv6/tcz/python.tcz.list:
Quote
usr/local/lib/python2.7/lib-dynload/_tkinter.so
usr/local/lib/python2.7/lib-tk/Tkinter.py

Offline Chau

  • Newbie
  • *
  • Posts: 20
Re: Displaying image using python
« Reply #2 on: September 19, 2017, 12:33:31 PM »
Hi Rich

Thanks for your reply. I actually had installed tk but overlooked the difference between Tkinter and tkinter  ???

I have installed Xorg too since I expect to need it when using Tkinter to display an image. And maybe you can give me a hint on that part too:

Currently I'm just trying to do some basic stuff with Tkinter:

Code: [Select]
from Tkinter import *
root = Tk()

And this is where my next issue arises:

Code: [Select]
_tkinter.TclError: no display name and no $DISPLAY environment variable
Calling env in the console shows indeed no DISPLAY variable.

How is Tk connected to the monitor? I thought this was where Xorg came into play  :-\

I'm accessing the PI directly and not through SSH or similar.