I am coding kivy app on PC. At the end, I will convert it to .apk on my android phone (redmi note 9 pro). Which window size should I choose? It will be easier to code with this specific window size (add buttons and text on specific place).
And how to do it. Because I heard that using window.size is not good/not working.
Thanks
It's usually a better idea not to code for a specific window size, but to code the gui in such a way that regardless of the window size it tries to do something sensible. For instance, your app might have a navigation bar at the top that is always 40dp high, then the rest of the app is taken up by something else that grows to fill all the available space.
You can code the whole gui to a fixed size if you want of course, but it probably isn't the best solution.
Related
I am having a small issue with PYQT that I cannot seem to find an answer for. I have made several apps using PYQT that do a multitude of functions but they all seem to have this one similar issue. When I leave my machine (windows 10) idle for a bit (not moving mouse/keyboard), the display will appear to 'freeze' but it is not actual frozen, just the display. The way to fix this is to change ANY element (increase spinbox value, minimize/maximize screen, etc).
This is particularly a problem with a video app I am working on where a camera is displaying video and suddenly it looks like the app is frozen until I 'fix' it. I am not sure if its a PYQT thing or perhaps windows itself. I will post relevant code below:
I can post more as needed but this is how I start my app:
app = QtWidgets.QApplication(sys.argv)
window = Ui()
widget = QtWidgets.QStackedWidget()
widget.addWidget(window)
widget.showMaximized()
app.exec_()
window.stop_threads()
cv2.destroyAllWindows()
I'm curious if it's at all possible to have the icons in MDBottomNavigation not scale with the window of the application? I would like it to act almost the same as DaVinci Resolve if anyone has used that program. Where the icons are in a fixed position and size regardless of the window size. Any ideas would be appreciated.
For reference, I'm using a .kv file not just writing everything in python.
I am trying to make my GUI icon go bigger.
I tried this:
MainWindow.setWindowIcon(QtGui.QIcon('Logo1.png'))
MainWindow.setIconSize(QtCore.QSize(128,128))
When 'Logo1.png' is 128x128
When I change numbers SetIconSize line, like this:
MainWindow.setIconSize(QtCore.QSize(500,500))
It doesn't show on my GUI.
My questions are:
Does this happen because I need my logo to be smaller something like 28X28?
If I need a specific size, what size is it and how do I make my logo this size?
Even if I do need a specific size, why wont setIconSize change my icon size?
The iconSize property documentation of QMainWindow explains that:
[The] size of toolbar icons in this mainwindow.
As you can see, it has nothing to do with the windowIcon.
It is up to the underlying OS and its window manager to decide the size of the icon, whether its shown in the window decoration (tipically in the title bar), the task manager/window switcher or anything else, and you don't have any control over it through Qt.
The only "exception" is when drawing client-side windows: windows for which the whole decoration is drawn by the program (the title bar with its system buttons and icon, the frame around the window, etc.).
That is, though, something that is usually discouraged as it's hard to achieve without facing various difficulties (both with drawing and interaction); it also makes the window appearance inconsistent with the whole system and could also create issues with accessibility for visually impaired people.
I am currently making an embedded multi-touch software using Kivy.
However, our hardware spec is little tight, so I am trying to optimize GUI for better performance.
Then I've found that Kivy Popup is slow when first pops up then gets faster after that. So now I am guessing that Kivy is doing some caching.
So, I want widgets, especially popups and screens since they are very slow, to act like they were opened once before.
I've tried to open and dismiss every popup widgets and go through all the screens when initializing the program. It seems quite effective except that I could not figure out how to hide the screen changing yet, but I am looking for some better approach.
I've looked for kivy document about kivy.cache here
But it is not clear whether this is what I am looking for or not. In addition, it is hard to understand what do I have to do and what to expect as a result. (Seems it does not work in a way that I want anyway)
It would probably be best to find what takes most time during the first startup, to make sure to cache that, instead of preloading every possible widget. One possibility is that it's just loading the default style texture, which you can load by setting the source of any image widget to images/defaulttheme-0.png, the first widget that needs it (that includes popup) will not to load it itself if you do. If you find that even after displaying a Button, the first Popup is still slow to load, then that's certainly something else, maybe running kivy at trace log_level will help seeing what happens last before the slowdown.
python -c kivy:log_level:trace main.py
I want to set the resolution of my application as per the resolution of the system screen its running on. i want to be on top and also in full screen covering even the taskbar as i am using windows. i want the app to open like the ATM interface, so the app should fill the entire screen.
please help me to find the solution.
thanks
The frame object has a "ShowFullScreen" method that you could use. I just tested it and it works alright, although it doesn't show the title bar of the app. I don't know if you care about that though.
EDIT: Uh, to call a method on the frame object, you would do something like
self.ShowFullScreen(True)
or
myFrame.ShowFullScreen(True)