-
-
Notifications
You must be signed in to change notification settings - Fork 375
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Briefcase run does not include Tkinter #318
Comments
Thanks for the report. So the issue here isn't briefcase specifically - it's the support package. The support packages that Briefcase uses by default don't include tkinter (on purpose) - this is because getting a working tkinter build can be complicated. tkinter support requires external libraries that aren't always available, and they can't be obtained easily using purely Python tooling. In the case of the Windows support package specifically, briefcase is actually using the Python-issued "embedded" distribution, which also doesn't include tkinter (on purpose, for the same reason). It is entirely possible to support tkinter - however, you need to provide your own support package that includes tkinter and all it's additional dependencies. If your requirement is around matplotlib specifically, you may have more luck using a different plotting backend. matplotlib has a pluggable rendering backend, and there are backends for widget toolkits other than tkinter (Qt, for example). Using one of those backends may be an easier option than trying to get tkinter support, as those widget kits have better Python installation support. |
One more note - at the very least, we should document that Tkinter isn't supported. Ideally, we'd be able to identify that the project won't work because of the support package - but programatically identifying that will be complex. |
Hey, replaced usage of Tkinter with WX and it works! Thank you very much :) |
Hi @freakboy3742, I'm facing the same issue at the moment and found this issue. |
@mocaccano It's not trivial, and I can't point you at an easy set of instructions to include it. While Tkinter is part of the standard library, it isn't part of the Windows embedded install - because it's not easy to redistribute. That's the same reason that we don't include it in the macOS support package that Briefcase uses. |
Thanks for the reply. If I replace the part of the code which uses Tkinter by PySide6 which is one of the GUI options proposed by Briefcase, would it solve the problem of packaging? |
@mocaccano Yes, you can use Briefcase to package PySide packages. You can also use Toga, BeeWare's own GUI framework. |
Hey I think I have a copy of tkinter for python 3.12 from my install of it. |
My tkinter support package is at https://internalfiles.johnnytech.net/githubfiles/briefcase-tkinter-issue/tkinter-support-package.tar |
@jhi2 Thanks for sharing that. On this note; we're currently landing our iOS patches in CPython, which has required us to rework how CPython is built for iOS. This has had the unexpected side effect that with very few modifications, we're able to use the officially distributed CPython binary for macOS apps as the support package for macOS - which includes support for Tkinter. It will likely still be a couple of months before this becomes "production ready", but you can see the work in progress here. |
Well, I have Windows |
@jhi2 I'm in the process of making a GUI app which uses tkinter on python 3.10 that I want to work on windows and macOS. How do I use your support package to allow briefcase to work? |
@cylewis The short version is that you need to compile a version of the CPython support packages that include tkinter. This is not a simple task, as Tkinter isn't a simple thing to distribute - the official Windows embedded package (which is what Briefcase uses) doesn't include tkinter specifically because of the difficulties of packaging tkinter. Honestly - my suggestion is that you need to have a very good reason to use tkinter in this day and age. There are much better GUI toolkits available these days, and they're not subject to the distribution issues that tkinter has. |
@freakboy3742 Thanks for the response, I chose customtkinter as the GUI library to build my app with 6 months ago, if i knew then what I know now, i would not have used it. I guess my very good reason to use tkinter is that I already have the app made using it. I'll look into your suggestion though, it might be a bit outside my skill level. |
Because It is the easiest way to make a GUI
…________________________________
From: Russell Keith-Magee ***@***.***>
Sent: Thursday, May 30, 2024 4:40 PM
To: beeware/briefcase ***@***.***>
Cc: jhi2 ***@***.***>; Mention ***@***.***>
Subject: Re: [beeware/briefcase] Briefcase run does not include Tkinter (#318)
@cylewis<https://github.com/cylewis> The short version is that you need to compile a version of the CPython support packages that include tkinter. This is not a simple task, as Tkinter isn't a simple thing to distribute - the official Windows embedded package (which is what Briefcase uses) doesn't include tkinter specifically because of the difficulties of packaging tkinter.
Honestly - my suggestion is that you need to have a very good reason to use tkinter in this day and age. There are much better GUI toolkits available these days, and they're not subject to the distribution issues that tkinter has.
—
Reply to this email directly, view it on GitHub<#318 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/A3V45HFZ5C3WR5V4SOYZ32DZE62GBAVCNFSM4LFJWGI2U5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TEMJUGEYDANZQGI2A>.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
Sorry, It does not work right. I do not how to make a support package. Though, I do have the source.
…________________________________
From: cylewis ***@***.***>
Sent: Thursday, May 30, 2024 12:37 PM
To: beeware/briefcase ***@***.***>
Cc: jhi2 ***@***.***>; Mention ***@***.***>
Subject: Re: [beeware/briefcase] Briefcase run does not include Tkinter (#318)
@jhi2<https://github.com/jhi2> I'm in the process of making a GUI app which uses tkinter on python 3.10 that I want to work on windows and macOS. How do I use your support package to allow briefcase to work?
—
Reply to this email directly, view it on GitHub<#318 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/A3V45HEXMRMMR2Q2R5KZYTLZE55ZDAVCNFSM4LFJWGI2U5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TEMJUGA3TINJXGE2A>.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
I was wondering about the same thing - it is just way easier to create nice looking gui applications with customtkinter - everything seems to be way more intuitive. An integration would be very welcome, though I understand that toga was made to replace non-pythonic gui apps. |
FWIW, I was able to use tkinter with Briefcase. Warning: This is intended purely as a proof-of-concept; use at your own risk.
path = python_home + "\\Lib";
debug_log("- %S\n", wstr(path));
status = PyWideStringList_Append(&config.module_search_paths, wstr(path));
|
The first answer on https://stackoverflow.com/questions/37710205/python-embeddable-zip-install-tkinter does the trick. Though, it forgets to mention that you also need the tkinter folder under |
This is going to be quite long, hope It's Ok
I have a Briefcase project that shows matplotlib plots from a compact GUI.
I'm working on Windows with python3.7. When I run my program using
briefcase dev
it's working ok, but when trying to run it withbreifcase run
it fails.I went down the rabbit hole and saw that on windows it runs the program using
windows\src\FORMAL_NAME\python\pythonw.exe -m MY_PACKAGE_NAME
. I tried to run it manually and saw that nothing is printed, not an error and not anything else.I saw that in the same directory there is a
python.exe
file so I ran it with-m MY_PACKAGE_NAME
and I got the following error:I looked at the
windows\src\FORMAL_NAME\python\
and I saw that indeed Tkinter is not there.Is that on purpose? how can I manually add Tkinter to there?
The text was updated successfully, but these errors were encountered: