picandies
Posts: 240
Joined: Wed Nov 26, 2014 5:13 pm

Question about TKINTER & GUI appearance

Tue Jan 23, 2018 5:58 pm

I've written some TKinter gui apps, but not super impressed, the buttons I get are just plain colored rectangles. How do you get rounded corners, borders, maybe 3d effects (such as pushing the button) & other things to fancy them up? I am using RPI3 & python (either 2 or 3 is fine).

Heater
Posts: 16092
Joined: Tue Jul 17, 2012 3:02 pm

Re: Question about TKINTER & GUI appearance

Tue Jan 23, 2018 6:14 pm

You don't.

Your best bet is to create you GUI in HTML and serve it up as a web page from your Python program. Then you can use all the GUI rendering power of HTML, CSS, SVG, WebGL, Javascript, etc that a browser rendering engine offers. With the added bonus that you can now view that GUI and control you application remotely from any browser.

Don't want to use a browser? That's OK, when you have that web page working wrap it up in Electron as a self-standing application. https://electronjs.org
Memory in C++ is a leaky abstraction .

picandies
Posts: 240
Joined: Wed Nov 26, 2014 5:13 pm

Re: Question about TKINTER & GUI appearance

Tue Jan 23, 2018 7:07 pm

HTML is a thought, but I'm not familiar with webpages & not interested in any browser (maybe Electron is a help there). What bothers me most about the TKINTER buttons are the square corners, rather than rounding. I was looking for some fancy button widgets, or add-ins that might be a work around. I'm doing all of the programming on the pi. Maybe creating it on the PC in some sort of graphical designer & loading onto the pi would be feasible?

scotty101
Posts: 3958
Joined: Fri Jun 08, 2012 6:03 pm

Re: Question about TKINTER & GUI appearance

Tue Jan 23, 2018 10:01 pm

Tkinter doesn't support anything fancy.
You could try another GUI Framework like Kivy or PySide(QT wrapper)
Electronic and Computer Engineer
Pi Interests: Home Automation, IOT, Python and Tkinter

picandies
Posts: 240
Joined: Wed Nov 26, 2014 5:13 pm

Re: Question about TKINTER & GUI appearance

Tue Jan 23, 2018 11:00 pm

Are there widgets or other add-ons/imports for TKINTER? I was hoping to build on what I already had done. But I'm not happy with those "dead-looking" buttons.

Maybe MATLIBPLOT or SCIPY would support some gui designs (since I will eventually need to plot some sensor reading).

scotty101
Posts: 3958
Joined: Fri Jun 08, 2012 6:03 pm

Re: Question about TKINTER & GUI appearance

Wed Jan 24, 2018 10:11 am

To re-iterate...
scotty101 wrote:
Tue Jan 23, 2018 10:01 pm
Tkinter doesn't support anything fancy.
You could try another GUI Framework like Kivy or PySide(QT wrapper)
Electronic and Computer Engineer
Pi Interests: Home Automation, IOT, Python and Tkinter

Heater
Posts: 16092
Joined: Tue Jul 17, 2012 3:02 pm

Re: Question about TKINTER & GUI appearance

Wed Jan 24, 2018 10:56 am

Plotting sensor data in a web based page is easy. In the browser or in Electron. I have been using nvd3 to draw graphs and charts recently: http://nvd3.org/. There are many other Javascript plotting/charting libraries.

I use bootstrap.cs to make nice looking layouts, buttons, forms etc. https://getbootstrap.com/docs/3.3/css/#buttons-options

You can use bootstrap out of the box for a nice look or use some ready made themes. I like this one: https://bootswatch.com/cyborg/

Or of course you can tweak the CSS to make things look just how you like.
Memory in C++ is a leaky abstraction .

shcreasey
Posts: 1
Joined: Thu May 17, 2018 12:38 pm

Re: Question about TKINTER & GUI appearance

Thu May 17, 2018 12:40 pm

The following clip details how to get rounded buttons and other styling with tkinter!

I believe the appearance of tkinter has been improved a lot recently.

https://www.youtube.com/watch?v=oV68QJJUXTU

Return to “General discussion”