Using Tkinter with VS Code

Pilahi Moran
3 min readMay 31, 2021

As I’ve been learning Python, I’ve gone from using Pycharm to VScode to utilize Python with other languages. While going through this, use of tkinter is bound to come up.

Going into it, my class did not tell me that one cannot run an active GUI (Graphical User Interface) in a bash terminal. You need another program for that! It was a little frustrating because I had no issued with Pycharm but then again that’s made just for Python. So the error I go was such a surprise!

I’m sure fellow new coders may be thrown off by this but I’ll walk you through the steps that helped me. Silver lining it was added practice for using stackOverflow that got me these 2 helpful solutions 1.2. #2 offers some extended information as well but it is from 2016 so keep that in mind.)

There are some programs you can use but I went with Xming and Xlaunch for this. (You can download it here) Once it’s downloaded, it’s easy breezy lemon squeezy form there.

Set up your server by starting XLaunch:

Choose your window
I use no client for local projects/labs but you can use others for development.
Again, I just use the default which is a good start for practice

From there you will get the finish screen and it is all set up to use.

To ensure that Xming is running (and to see the server number)look at you far righthand side of your taskbar

You should see Xming running and the server number! From there, connect to your project like so:

Then run your code that uses tkinter and boop!

You can use tkinter with your VScode!

Hopefully this helps you and saves you a little time.

--

--

Pilahi Moran

Full Stack Software Engineer, Artist, Cook, and Illustrator. Mother of 2 cockatiels and 2 cats.