I built a small GUI using Tkinter. The GUI features, among some other elements, three buttons. These buttons serve to open a dystem dialog and select certain data-files etc. One of the three buttons is a 'Go' button that runs the underlying data-processing.
When running the .py script the GUI works fine. However, after creating a developer app in alias mode using Py2App the buttons have become invisible! They're still there and usable, but invisible until interacted with.
How can I prevent this from happening?
I was stuck in your exact situation for quite some time. When I ran my tkinter script, it worked perfectly and all the buttons showed up, but once I packaged it, the buttons stopped showing up (They were still there but you couldn't see them). After a long time of trying random things, I found out how to make the buttons and their text show up again. Simply resize the window. Even a difference of 1 or 2 pixels does the trick. I have not yet found a way to PREVENT this issue, but at least this makes the app look right.
Please reply if you figure out a solution to prevent this!
Good Luck!
Related
I am trying to make a GUI in python that only consists of 1 window. I think this is better explained with examples. If you have say the settings app open on the computer when you click an option a new window doesn't pop up, the original window changes the a new layout. Is there a way to do this without deleting everything in the window and then adding new stuff, and when going back doing the same process.
If you're using a QT based gui framework like PyQT or PySimpleGUI, you can accomplish this task using a Tab object. Here is a link to a sample program with using Tabs in PySimpleGUI
PySimpleGUI is a really good option for getting your feet wet with GUI development in Python. You can get a lot done with very little code and learn about how GUI's work.
So I am trying to make a python script that when I do a certain hotkey combination, It shows a text box as an overlay like what "Geforce Experience" and "Windows Gamebar" do.
the problem is that in the game when I interact with the text-area loses focus and goes minimized as opposed to the 2 programs I spoke about before, for example windows game bar allows you interact with a lot of options while the game is still on foreground and you close the bar you are left with whatever you were with before...
I'm using tkinter for now, and if there are solution not including tkinter it is Ok as long as it achives the goal.
As far as I understand what you are trying to do is create a overlay for a game and the overlay should be created using tkinter object. Here is a library that can do that, however as far as I remember you needed to change something in it's python file, however this might have already been fixed.
I am using a code designed by another person in MAC OS. I am using Windows instead and have slightly modified it, but the problem comes when using the GUI that is created.
I have already dealt with a similar issue with a slider. Once I pressed the slider, I couldn´t release it or press another button. I was forced to quit the GUI and start again. I solved it by changing the event command from EVT_COMMAND_SCROLL to EVT_COMMAND_SCROLL_THUMBTRACK. However I did not understand why it worked in MAC OS and does not work in Windows.
Now, I want to close the GUI with the typical cross inside the red button in the right corner of the window. I can do it if it is the first order I do in the GUI. If I first press any button or slider, the exit button does not work.
It made me consider if a major problem is hidden in the code which I am not seeing. I am new at wxPython, which is the module used in the code.
I just ask for your opinion and hope it is a basic error.
Thanks very much
I am building an user interface using Python, Gtk3 and Glade. I want to change several things on the UI at the same time (i.e start an animation and display a new text) which leads to the application freezing.
I have read that Gtk wasn't thread safe so I didn't used the Thread module.
Instead, I used Glib.idle_add and Gdk.threads_add_idle functions. I am tryig to update a treeview, display some text and show an animated logo at the same time. The application works but it freezes a few seconds and then everything appears at the same time. I try to set different priorities to the threads but it does'nt seem to fix it.
Gtk.threads_add_idle(Glib.PRIORITY_DEFAULT, label.set_text, "text_to_set")
Gtk.threads_add_igle(GLib.PRIORITY_DEFAULT, function_to_display_logo)
I expect the different texts and the treeview and the logo to be displayed without any freeze. Does anyone know how I can fix that ?
Please have a look here at a script example in https://github.com/f4iteightiz/UWR_scoreboard : a GTK window is updated all 0,2s for example (countdowns of several timers appearing in labels; I think anything else could be updated) and it stay reactiv the whole time. No freezing noticeable.
I found out what my error was. I was using the GLib.idle_add function too many times even in some cases where I had no use for it.
For example in the main code I had :
Glib.idle_add(my_function,buffer)
but my_function looked like this :
def myfuntion(buffer):
GLib.idle_add(buffer.set_text,"text")
I deleted the GLib.idle_add call in the main code and now it works perfectly.
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