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.
Related
How can I can a function and create a function for the icon context menu? I want to make the iconic Open New Window function pop-up when you right click on the icon menu in the taskbar/dock. See this question for more info on this kind of question.
Places I have looked but found nothing:
https://www.tcl.tk/man/tcl8.5/TkCmd/tk_mac.html#M15
https://pyinstaller.org/en/stable/feature-notes.html#open-event-handling-in-a-tkinter-based-gui-application
While there are a tiny subset of apple events that you can benefit from the DockMenu is not accessible directly via tkinter. Turns out mac is not really open for modifications and even smaller tasks can be hard. You could consider to use a system tray icon instead.
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 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!
I have C# experience, and I'm making my first Python app. I'm part way done the UI in QT Designer, and soon I'll try PyQt to integrate it with my code. This is a general guidance question for best approach.
I have a tab widget containing various things in each tab. I would like the entire tab widget to be duplicatable with a plus button. So basically, a scroll view containing as many of these tab widgets as the user wants. The user could duplicate an existing one as a new instance, or create a blank one.
Could someone please help me understand how to accomplish this? Does it work like this?
Create the scroll view.
Put the tab widget inside the scroll view.
Add duplicate and delete buttons in the corner of the tab widget.
Put a plus button just outside the scroll view.
Accomplish all of the rest via python code? Or would I be missing out on some Qt Designer tricks?
Any tips on how to do this in QT Designer and also coding in PyQt would be appreciated.
Additionally, perhaps off topic, but any general tips on PyQt installation and usage would be nice. v5 not v4? I'm running Python 3.6 32 bit, which I was told should run 3.5 packages fine (but 64 bit may not).
Thanks,
First the out of topic : use PyQt5 if you start a new project. Qt 4 has reached end of life and won't see any new release unless it's a critical security fix.
As for most of your questions: if you want to use Designer then you should start by taking a look at Qt Designer's documentation. It will get you started nicely.
As for 5, it depends on tastes. Developers have been using both for various reasons. It's really up to you decide which style fits your needs best. There's no tricks in designer that you can't accomplish in code.
I am in the process of writing an app that I want to make a GUI for. I've got a little bit of experience with making GUI's in wxpython already, but one thing I have not had to try yet; is minimizing an application to tray. I have been doing my research and figured out how to make the icon, but what I have gotten stuck in the mud with is minimizing the Frame to the tray. I have found no functions that I can use to hide the frame with (wx.Frame.Hide() is not the answer). Do any of you know of any way that I could accomplish this? Thanks!
You need to look at the wxPython demo's source code. Look for the part which mentions the DemoTaskBarIcon. Then you'll want to bind to wx.EVT_ICONIZE. You do end up using the frame's Hide() method within the "iconize" event handler. How else would you hide it? Then to show it again, you'll want to use the menu from your task bar icon (which is technically a system tray icon on Windows). See also:
http://bytes.com/topic/python/answers/699757-wxpython-how-minimize-taskbar
http://wxpython-users.1045709.n5.nabble.com/minimize-to-try-question-td2359957.html