I am currently building a simple app to encrypt files using AES encryption in python but the biggest downside of using Tkinter is the look of the UI. I did some research and found examples of what I want but do not know how to recreate it. (Example)
My problem is that when I replace buttons with images (like the OP of the Reddit post said he did in order to have a decent looking UI) I end up with an ugly bar of grey. (Image of the button)
I also want to remove the same type of bar with frames so if you have the answer for specifically that it would still be appreciated.
Support for for styles and themes has existed in tkinter for some time. A theme being a collection of styles for different widgets.
You can read more about style and themes here.
To the best of my knowledge, the standard widgets to not support rounded corners. All widgets have rectangular shapes.
You might be able to create something like that using a Canvas, but it would be a significant amount of work.
A more relevant point is that it might confuse your users if you don't reproduce the way the standard controls work.
UI elements are standardized for the same reason the controls in a car are; once you know one of them you can use all of them.
Related
I'm trying to make a volume controller in python tkinter. But what exactly the problem is that, I want to make it look rich and professional. So when I tried using tkinter scale widget, it worked. But the widget is just a normal one. I wanted to know a way to make it look like the image below I have sent.
My current one's code is this:
def slider(self):
self.scale = scale = ttk.Scale(self.canvas, from_=0, to=100, orient=HORIZONTAL)
print(self.scale.winfo_class())
self.scale.place(x=580,y=455)
self.scale.set(70)
Is there anyway I can make it look better like the one in the Image?
What all things I want is:
A knob like round thing like in the image which is movable
Some color should fill in the area that is already covered.
A pop up or anything to show the current details of the volume.
I'm using pygame to play music in tkinter btw..
If this isn't possible, please suggest me a better way/alternative to do this. Thank you.
As far as I know, there is no existing widget with a look exactly like what you are asking for. However, tkinter provides a way to craft your own widget styles, which might make it possible to do what you want.
Tkinter comes with a module named ttk, which stands for "themed tk". It allows you to define custom styles for individual widgets, and to bundle those styles into a collection known as a theme. If you want to create a widget with a custom look, you can use this module to do so.
Unfortunately, being able to design a custom theme for a widget isn't very well documented. The best documentation I personally know of is on tkdocs.com, in the section Styles and Themes. It gives a pretty good rundown of the terminology and overall description of how themes work. The python documentation for ttk also gives some additional information about creating styles and layouts in a section titled Ttk Styling.
For inspiration, you can check out the code for the ttkthemes project (github, public documentation) which has many different themes that you can examine. I doubt there is one exactly like you want, but you should be able to create your own after looking through the examples.
It is as easy as setting a theme for the TkInter project. Done in Python it looks like that:
s.theme_use('themename')
You might benefit from reading Styles and Themes documentation of TkDocs.
I am working on a small app that has some checkboxes. The app will be run on Windows 7 machines with the Windows Classic theme set. This means that all the checkboxes will have bezeled borders as shown in the screenshot below:
I wonder if there is a way to set the check boxes to have no bezel. If that is not possible, is it possible to custom paint/draw check boxes with no bezel? I have not been able to find examples. Thanks!
It really depends on the platform and/or the theme, and whether the native widget supports alternate views and such. So, in other words, for questions about customizing the LnF of native widgets in general, the answer is "maybe" but it probably depends on a number of factors that are not under wx's control.
On the other hand, making custom controls is much easier than most people think it will be. For something like a checkbox you'll basically just need to provide an event handler for EVT_PAINT that draws the current state of the widget using a wx.PaintDC, plus handlers for mouse and keyboard events to interact with the user. There are several examples in the wx.lib package that you can use for inspiration, such as wx.lib.stattext or wx.lib.buttons.
I am trying to build a Kivy application with a sharp, crisp look and feel but the default Kivy UI is not exactly what I had in mind? Is there any way to create a custom theme to give your Kivy app style?
This app here is called Pithon and it was made from Kivy. I have searched everywhere but I can not find anything on how the developer managed such a clean look. Does anyone have any ideas?
A kivy developer called Andrés Rodríguez released a set of widgets based on google's material design principles. I am currently using them myself and they have surely saved me from alot of work. You can find KivyMD here (see bottom of this answer for more info). Their are some themes also based on the same principles but am yet to try them out one is FlatKivy and another is kivy material ui by Federico Curzel.
Some screenshots for kivyMD,flatkivy and kivy material ui respectively are here.
Click the highlighted links you will find a lot more info about the three projects.
The original KivyMD project by Andrés Rodríguez is no longer maintained but there is active fork of KivyMD by HeaTTheatR.
(Almost) all widgets have properties that can be used to set aspects of their style. For instance, with a Button you can change the background colour, the background image when pressed or released, and the size of the border region (it's scaled like in CSS border images). You can check the documentation for the specifics of a given widget.
An theme like in the screenshot you posted could be achieved by turning off background images for the buttons and just using solid colours, with the non-button text being normal Labels and the circle being drawn directly with a kivy canvas instruction or via an Image widget (along with an image of the circle).
I notice you mentioned padding in a comment but I'm not sure what you mean by it - do you mean the distance between the buttons? They may well be placed in a GridLayout which has a padding property controlling this, so you could set it to whatever you like.
I recognise that you're asking a more general question than 'how does this screenshot do it?', but the key point is that just about everything is customisable and it doesn't take many changes to go from the default theme to your image.
Edit: One useful feature that helps this kind of customisation is that you can use kv language to override styles for widget classes very easily, so you don't need to manually change every button etc.
I am looking to make a GUI in python but currently do not have much experience. The GUI must have a few key features, namely a slider bar to control audio, and a few basic menu buttons. I realize essentially all GUI development tools could handle these simple features, but I am also interested in some custom content as well. The basic look of the GUI I am looking to create is shown here:
In the image, the slider volume bar, "button1," "button2," the colored circles, and any slice of the circle (one highlighted section is shown) needs to be clickable and interactive. Moreover, the small colored circles must be able to dynamically revolve around the edge of the circle and remain clickable at all times. I have not used any GUI development tools yet, but have looked into pyGTK, pyQT, wxWidgets, and Kivy. Can anyone who has used these tools recommend which would be best suited? As far as shapes of buttons, am I restricted?
You can use pyopengl, pygame , pygtk .
I have one example how to show this images if you want take a look at :
http://free-tutorials.org software free section is decor.tgz example.
In my opinion you can use pyOpenGL is very portable to another language like C,C++ and also you can make it to Linux , Windows , Android.
I would like to implement a swipe or flipper view (widget) using PyGtk for my Quickly app. There should be a titlebar that contains the title of the currently showed content and the titles of the previous and next entry. To navigate threw the different entries you should be able to click the titles or swipe from left to right or vice versa.
But I do not know where to start.
Which Widget should I extend?
Would the Notebook widget the right choice?
How could I change the style of a Widget?
How do I implement the flip effect?
Do I have to combine different views (widgets) for the content pane and the titlebar?
For a better understanding of my problem view the screenshot below.
Thanks and best regards
Andreas
You might want to take a look at Clutter. Though I think, this kind of UI-Design could be very unintuitive on a desktop machine.