does tkinter come installed with python 2.7?

For discussions about programming, and for programming questions and advice


Moderator: Forum moderators

Post Reply
Gary73
Posts: 9
Joined: Sun Mar 28, 2021 1:29 am
Been thanked: 5 times

does tkinter come installed with python 2.7?

Post by Gary73 »

Hi there, I have been using the Bionic 32 Puppy Linux distro. Big thanks to anyone/everyone who worked on it.

I am trying to use Tkinter GUI along with the python 2.7 that comes pre-installed.

when I try import Tkinter with statements like from Tkinter import *, It does not want to import.

There appear to be Tkinter files on the system in the folder:

/usr/lib/python2.7/lib-tk/

It looks like there are modules for tkFileDialog Tkinter.py turtle.py, etc, probably about 20 modules in that folder.

I even copied the contents of that folder into my local project folder but the modules don't seem to load or work.

I was wondering if I need to do something else to get Tkinter to work.

I was really hoping not to have to install anything else to achieve the use of Tkinter GUI,
because I am writing a program that will run directly after initial load, and I am trying to keep the OS
as lightweight as possible.

Thanks to anyone who can give me some insight on how to proceed.

Thanks,
Gary

User avatar
rockedge
Site Admin
Posts: 5825
Joined: Mon Dec 02, 2019 1:38 am
Location: Connecticut,U.S.A.
Has thanked: 2078 times
Been thanked: 2172 times
Contact:

Re: does tkinter come installed with python 2.7?

Post by rockedge »

Normally no. Can test if it is by trying the next part of the post. Make sure the Bionic32 devx.sfs is loaded!
Easiest way is to open the PPM and install python-tk then open the python console in a terminal and try import tk to test it.

(3).png
(3).png (16.4 KiB) Viewed 584 times

python3 would be python3-tk

Sometimes I have just reinstalled Tkinter to get it going

Gary73
Posts: 9
Joined: Sun Mar 28, 2021 1:29 am
Been thanked: 5 times

Re: does tkinter come installed with python 2.7?

Post by Gary73 »

Thank you for the quick answer.

I think I may try a little different route in how I am approaching this problem.

My program is intended to run right after installation, to help with configuring the menus, program names, trays etc in a mostly automated fashion. Right now, I just use a combination of bash style scripting and python scripts using command line and the input is a text file containing csv data. So if I need to make any changes, I change the text file which is an input for the program. I think it woul d be more intuitive to use a GUI so that's why i was looking into this.

I may write a GUI version of the program on a different computer and use the "pyinstaller" program to create a standalone version of my program, packaged with all its dependencies. This way, it can just be copied and pasted into a folder for use, or just use off of a thumb drive.

I think this may be better, because I can run it from thumb drive then remove it without adding any bloat to the operating system.

User avatar
rockedge
Site Admin
Posts: 5825
Joined: Mon Dec 02, 2019 1:38 am
Location: Connecticut,U.S.A.
Has thanked: 2078 times
Been thanked: 2172 times
Contact:

Re: does tkinter come installed with python 2.7?

Post by rockedge »

Gary73 wrote: Mon May 24, 2021 4:59 pm

I may write a GUI version of the program on a different computer and use the "pyinstaller" program to create a standalone version of my program, packaged with all its dependencies. This way, it can just be copied and pasted into a folder for use, or just use off of a thumb drive.

I think this may be better, because I can run it from thumb drive then remove it without adding any bloat to the operating system.

Interesting! If you make an alpha or beta I'd like to see it and test it.

Gary73
Posts: 9
Joined: Sun Mar 28, 2021 1:29 am
Been thanked: 5 times

Re: does tkinter come installed with python 2.7?

Post by Gary73 »

Thank you. I have used that pyinstaller program to make self contained environments for use in windows, assuming not everyone will have python on a windows system. I am interested to learn more about repositories, .pet packages and so forth. I think to use pyinstaller, you can't cross compile and believe that means if I package the program on a 32 bit system, it would run on a 32 bit system. But it seems like maybe that is a viable way to make programs that run on a system without actually installing dependencies per se.

I am sort of new to Linux and Puppy distros have been my favorite because they tend to run on very old systems and can run of flash drives with persistence.

I actually decided to do something different and I used a combination of bash scripting where user input is typed into the command line, but then if I need a window, I would put the text
in a file and "leafpad" that file. Which is a little funny, but it did work out well I think. For example, I would ask, do you want to edit this file, if they answer yes, I would pop the file up in leafpad. I guess I used it like a 'poor-man's" text entry widget.

I posted the project in the puppy projects area of the forum and if you are interested the link to the project is: https://github.com/garydavenport73/puppymint/, but I think the proper place for advice on the project is in that forum.

Post Reply

Return to “Programming”