-1

I don't know if you can understand the difference, but in the image the text of my button is "Imposta", but when I compare it with the text above the button, for example "View", "Navigate" etc., that text seems more sharp and detailed comparing with "Imposta". Do you know why and how to solve this? I'm using tkinter.

enter image description here

Sylvester Kruin
  • 3,294
  • 5
  • 16
  • 39
  • Possibly related https://stackoverflow.com/questions/41315873/attempting-to-resolve-blurred-tkinter-text-scaling-on-windows-10-high-dpi-disp – Cory Kramer Apr 29 '22 at 20:19
  • Hey thanks you solved my problem, i simply added "from ctypes import windll windll.shcore.SetProcessDpiAwareness(1)", thanks a lot ! – Stefano9669 Apr 29 '22 at 20:24

1 Answers1

-1

Buttons do not have an intrinsic theme, each application has to provide their own way to draw buttons. Turns out that Tkinter is an outdated toolkit, that still provides what used to be the standard way to draw buttons at the time it was created. If you want to have a better gui, consider switching to a modern toolkit, of which there are plenty. The most popular are probably Gtk and Qt, for which there are bindings in almost any language.

jthulhu
  • 7,223
  • 2
  • 16
  • 33
  • Hi, i don't know i'm learing a lot of tkinter, but if you say that is outdated ... I solved my problem writing "from ctypes import windll windll.shcore.SetProcessDpiAwareness(1)" by the way – Stefano9669 Apr 29 '22 at 20:25
  • Is Tkinter really outdated comparing to Gtk and Qt? What can they do more that tkinter can't do ? – Stefano9669 Apr 29 '22 at 20:27
  • Might have misunderstood your question, I though you were asking about why the button is so ugly. Also, Tkinter *is* outdated. It's not (just) a question of functionalities (even if Gtk and Qt provide a **bunch** more functionalities), it's also a question of adaptation to modern standards. With Gtk of Qt, you would never have to do what that ugly `windll.shcore.SetProcessDpiAwareness(1)` because it would be taken care of. – jthulhu Apr 29 '22 at 20:30
  • I, too, started by learning Tkinter, and honestly, just jump straight to Gtk. The basic concepts are very similar, in fact at the beginning you may not even notice the difference when writing code. But, in the long run, you'll spare yourself having to switch. – jthulhu Apr 29 '22 at 20:31
  • Ok one last question, in terms of graphic of button and graphic in general, does Gtk give more opportunities and more choice comparing to tkinter? – Stefano9669 Apr 29 '22 at 20:51
  • In general, Gtk will not offer you *more* choices than Tkinter, it's just going to be easier to do things with Gtk (you can think of Gtk as an upgraded version of Tkinter). There are still things that Gtk does natively and that you have to do by hand in Tkinter. This is not true for Qt, as Qt does provide considerably more features than Gtk (and therefore than Tkinter). Also, you may find something like Glade useful when designing interfaces (as you'll soon understand that hardcoding interfaces is too painful to maintain). – jthulhu Apr 29 '22 at 21:14
  • Ok thanks, could you please give me some documentation for learn all (or almost) gtk or qt? Maybe an online manual or a book that i can buy from Amazon, maybe share a link – Stefano9669 Apr 29 '22 at 21:18
  • You can literally find these everywhere, Gtk and Qt are widely used tools. The first link that comes up in google is https://python-gtk-3-tutorial.readthedocs.io/en/latest/, which is a tutorial that will go through every basic widgets you can find in Gtk in Python, and a bit further too. – jthulhu Apr 29 '22 at 21:20
  • Yes thanks, but for example when explains the Button why in the code there are “class” ? I don’t use a class to create a simple button in tkinter and i don’t even know what is a class..Sorry i’m a beginner, can i create buttons in gtk without a “class” this is the last question i promise ahah – Stefano9669 Apr 29 '22 at 21:36
  • Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/244349/discussion-between-blackbeans-and-stefano9669). – jthulhu Apr 30 '22 at 04:33