#πŸ”’ Install Tkinter for VSCodeFlatpak on LinuxMint

115 messages Β· Page 1 of 1 (latest)

mint spire
#

for some reason LinuxMint does not come with Tkinter so I always have to run:

sudo apt-get install python3-tk

in order to get Tkinter on Linux Mint (and I indeed can run Tkinter apps from my Terminal)

With that being said, now I'm not only using VSCode (which installs its own interpreters) but it's Flatpak Version so I'm stumped.

With a flatpak, the point is to sandbox the software so wouldn't choosing a system interpreter be the opposite of what I would want to do?

If so, how do I install Tkinter to a interpreter that is built-in to VSCode if its not available on pip? or is it? I'm lost.

topaz widgetBOT
#

@mint spire

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

glass pollen
#

it uses any available interpreters it finds

mint spire
#

when i added the Python extension, it shows a Python 3.11 version.. i dont have 3.11 on my computer so I had to have gotten it from VSCode

#

supposedly if you run this command:

 ls /usr/bin/python*

you can see all of your python installations?

#

this is what I have:

/usr/bin/python3 /usr/bin/python3.10-config /usr/bin/python3-qr
/usr/bin/python3.10 /usr/bin/python3-config

glass pollen
#

that is your system python

mint spire
#

yeah see so I don't have 3.11

#

but its in VSCode

glass pollen
mint spire
glass pollen
#

never seen that before

fast stirrup
#

Doesn't seem that isolated to me

mint spire
#

ikr

#

Microsoft spooks me

fast stirrup
#

You could use the 'enter interpreter path'?

mint spire
#

hm yeah maybe.. which path should i try

glass pollen
#

back to your original question, if that's actually a new python installation then it should already come with tkinter

#

tkinter doesn't come with system pythons since it's usually unnecessary

mint spire
#

im just assuming its a new python installation.. because i definitely dont have 3.11 on my computer

fast stirrup
#

Why not?

#

Oh

#

3.12?

mint spire
#

no i just use whatever comes with the OS

#

it came with 3 and 3.10

fast stirrup
#

Interesting

mint spire
#

this is from using:

/usr/bin/python3.10
glass pollen
#

it shows my system python and the interpreters i installed using pyenv

mint spire
#

how'd you manage to get 3.9

#

pyenv? from the terminal in vscode?

glass pollen
#

it's a shell program

mint spire
#

hm if i installed that would i install it from within my flatpak'd vscode?

#

if i created a virtual env.. i dont even know if i would choose a path inside the vscode's directory or my own path in /home

glass pollen
mint spire
#

not that i can install tkinter to it but still

#

Enter a command: sudo apt-get update
Ign:1 http://packages.linuxmint.com virginia InRelease
Hit:2 http://security.ubuntu.com/ubuntu jammy-security InRelease
Hit:3 http://archive.ubuntu.com/ubuntu jammy InRelease
Hit:4 http://packages.linuxmint.com virginia Release
Hit:5 http://archive.ubuntu.com/ubuntu jammy-updates InRelease
Hit:7 http://archive.ubuntu.com/ubuntu jammy-backports InRelease
Reading package lists... Done
Enter a command: sudo apt-get search pyenv
E: Invalid operation search
Enter a command:

glass pollen
mint spire
#

ah ok

glass pollen
#

you also need to install necessary build dependencies

sudo apt install build-essential libssl-dev zlib1g-dev \
libbz2-dev libreadline-dev libsqlite3-dev curl \
libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev
regal wing
topaz widgetBOT
#

flatpak-warning.txt lines 31 to 42

This Flatpak provides a standard development environment (gcc, python, etc).
To see what's available:

  $ flatpak run --command=sh com.visualstudio.code
  $ ls /usr/bin (shared runtime)
  $ ls /app/bin (bundled with this flatpak)

To get support for additional languages or tools within the Flatpak, you have to install SDK extensions, e.g.

  $ flatpak install flathub org.freedesktop.Sdk.Extension.dotnet
  $ flatpak install flathub org.freedesktop.Sdk.Extension.golang
  $ FLATPAK_ENABLE_SDK_EXT=dotnet,golang flatpak run com.visualstudio.code```
mint spire
#

idk, i'm not a fant of installing stuff outside of the repository

#

-t

#

i'm trying to ask in the linux mint irc but idk if i'll get a response tonight

glass pollen
mint spire
#

i literally just had my google account compromised 3 days ago so i'm kinda sketched out

#

took a hammer to my phone last night because even after factory reset i still had malware in it.. i dont want to go down that path anymore

glass pollen
mint spire
#

its all good ty for your help.. i'll probably use the .deb version because i dont have any choice really

#

either that or give up Tkinter all together and maybe go pygtk?

#

kind of sad though because i've put years into learning Tkinter and haven't even made anything out of it really

regal wing
#

i havent done much GUI work outside of some tkinter recently, but if you're curious, the project i recently worked on was a kind-of-an-IRC application using my own network protocol, and i went with tkinter for the client GUI

#

i was more interested in the networking and code architecture so i didnt put too much effort into making the GUI look outstanding

mint spire
#

you did good imo.. its clean and works.. thats about all I'm really good for tbh

#

wrap='none' on your big text widget on the right maybe? so you dont have to deal with that horizontal scrollbar

#

idk

#

err actually other way around lol not none

#

wrap='word'

#

in order to colorize people's names and other stuff in your text widget, you need to create like tags

regal wing
#

there's a minimum length of 800, if the window was bigger itll autowrap to match the window size

#

and im using labels nested in a frame nested in a canvas rather than a text widget

mint spire
#

if it were me, i would give the left side with your listbox a fixed width but the right half just not provide a width.. just use a relative width.. then you dont have to worry about determining what the user's resolution is.. and it'll grow when they maximize the window anyway

#

because a text widget has a fixed size by default anyway

mint spire
#

like a scrolled window

#

so you're kinda stuck with choosing a width then

#

well maybe whenever you insert the people's chat messages, you could programatically choose your width from there

#

canvas.winfo_width()

regal wing
#

yup, it does that with a minimum of 800px

#

perhaps i could lower it but i dont want to excessively break up the content

mint spire
#

the people's names are 1 label and the messages are another label?

#

and which layout manager are you using

#

someone said in the conversation of that picture "why does tkinter look so bad".. but it doesn't have to look bad if you use images

#

and making your own widgets ofc

regal wing
#

the structure is essentially: ChatFrame β”œβ”€β”€ ChannelList β”œβ”€β”€ SendBox └── MessageList └── ScrollableFrame └── Canvas └── Frame (inner) β”œβ”€β”€ MessageView β”‚ β”œβ”€β”€ Label (nick) β”‚ └── Label (content) └── ... and everything is laid out with grid (besides the inner frame)

mint spire
#

what is this messageview widget.. is it a treeview?

#

custom widget? maybe another module?

#

if it was Treeview, that's what i would go with

#

then your names and messages are lined up

#

81 degrees in my room and my floor heater is set to 70

regal wing
#

just a frame

#

i like that they're not lined up

mint spire
#

ah so you have a frame in a frame

#

i would put the entire thing in a paned window and then you could collapse the left if you wanted to.. not necessary but just an idea

#
panedwindow
    leftframe
        listbox
        vertical scrollbar
    rightframe
        treeframe
            treeview
            vertical scrollbar
        messageframe
            entry
            submitbutton
regal wing
#

ye thats seems like a fair design

#

i think the last time i used a panedwindow, the sash between the panes wouldnt show up so i couldnt resize it

mint spire
#

sashwidth='10'

#

sashrelief='groove'

regal wing
#

huh, it seems to work fine now...

mint spire
#

no run button in my VSCode by default =\

regal wing
#

yeah, that comes with the python extension

mint spire
#

yea i already installed it and selected interpreter

#

lol button shows up when i screenshot it

#

i guess i had to threaten it with a screenshot

#

we have success

#

oh wow now i know why the run button wasn't there.. when I click onto the left window.. the "Welcome" window, it goes away

regal wing
#

oh huh, you're right, the buttons only show for whichever tab you're focused on

mint spire
#

doesn't take much to confuse me

#

lol

signal flint
regal wing
# signal flint on most distros `/bin` is just a symlink to `/usr/bin` I believe that's the case...

supposedly they are actually separate directories:
https://www.linuxfoundation.org/blog/blog/classic-sysadmin-the-linux-filesystem-explained

But many modern Linux distributions just put everything into /usr/bin and have /bin point to /usr/bin just in case erasing it completely would break something. So, while Debian, Ubuntu and Mint still keep /bin and /usr/bin (and /sbin and /usr/sbin) separate; others, like Arch and its derivatives just have one β€œreal” directory for binaries, /usr/bin, and the rest or *bins are β€œfake” directories that point to /usr/bin.

signal flint
topaz widgetBOT
#
Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.