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.
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.
I am fairly new to Python and is stuck at a problem. I am using Python 3.7 and intend to add a "drag-and-drop" functionality to my GUI.
I have some files that needs to be read, thus i am looking for an option where i can simply drag those files to a particular area in my GUI and file name or Path is read by my program.
Being a newbie a detailed answer or a code would be highly helpful.
Thanks
Unfortunately, tkinter only supports experimental widget drag and drop, nothing else. I ran into similar problems trying to make a complex GUI.
I would look into wxPython. It's complex, Object Oriented, and daunting, but has and unbelievable amount of features that reward you for learning it. Including file drag and drop.
Look at the wxPython thumbnails at https://wxpython.org/Phoenix/docs/html/gallery.html for images of what the widgets look like. The thumbnails include images for about half of the available widgets. The images are also a bit out of date.
Look at pronounced https://pythonlibrary.org or https://zetcode.com for the best tutorials. After them, your best resource is Google and the forums.
There are lots of GUI environments for Python like Qt, tKinter, wx, PySimpleGUI, etc. so I have not been able to go through very many of them. I would like to know if there is one which is
somewhat similar to Visual Basic's (drag and drop and resize),
allows for arrays of textboxes and labels.
It should preferably be open source,
should create stand alone *.exe files,
and not requiring browsers.
The closest match to your requirements is probably PySimpleGUI. Doesn't have drag and drop, but you don't really need it. It takes 1 line of code to configure and place a widget into your window. You easily make an "array of textboxes and labels". Runs on tkinter or Qt.
Would that there were a simple drag and drop GUi builder for Python!
You might try appJar. It's not drag and drop but it seems pretty straightforward.
QtDesigner is drag and drop. It's part of the PyQT suite. QtDesigner creates XML (.ui) files which can then be translated to .py files. Michael Herrmann's site
shows how to do this with a minimum amount of overhead.
I personally recommend my project https://github.com/cdhigh/tkinter-designer.
tkinter-designer implemented a add-on in VB6, you can design your GUI in VB6 (drag and drop, resize, align, color, key-bind,...), and then this add-on generate a complete code frame. what you will do is add logic code in event method like coding in VB.
PS: You can install nano version of vb6.
In order to indicate activity, some applications (e.g. Pidgin) highlight their entry in GNOME's Window List panel widget (e.g. via bold font or flashing color). This indication is reset automatically when the window is activated.
I have a terminal application for which I would like to achieve the same thing (preferably via Perl, but Python would work too) - but I have no idea where to start. I imagine I'd first have to find the terminal window (based on window title) and then trigger some kind of GTK action.
Any help would be greatly appreciated!
In a GTK application, use gtk_window_set_urgency_hint(). If you have a terminal application, you can't really do that - with libwnck you can get information about other application's windows, but as far as I know you can't get a GtkWindow pointer to another application's window.
May I suggest using the terminal beep? Of course this isn't a sure way to attract the user's attention, but some terminals are able to flash the title bar instead of beeping, or such things.
I'm not really into GTK programming, but as far as i know you want to set an "URGENT"-Flag for the Window which should be highlighted. Maybe this will get you any further. :)
I've got a Python/GTK project I've been working on for a while, and some of the functionality I want already exists in Gnome panel applets. Based on my reading, panel applets are already in a subclass of the standard GTK Bin, so I would think there'd be a way that I can use the C-based GTK objects in my Python-based application.
For instance, I've got the fish applet in /usr/lib/gnome-panel/fish-applet-2 as a binary
Can I do some GTK magic to get that object so it can be embedded into my Python/GTK gui?
I'm not expecting a step-by-step walkthrough, but if anyone can point me in the right direction, I'd appreciate it.
The code for applets in gnome panel is quite complex. It's based on the gnome Bonobo framework (which in turn is based on CORBA). But now the whole thing is in a bit of a flux because gnome is moving away from Bonobo to a new dbus-based design. So if it's loading existing gnome panel applets you want you should absolutely use the code from gnome panel to do it. There is (or at least was) an example program included that does nothing but load an applet into a window.
If you want to display a widget from one of your own programs (a custom applet) inside another of your programs it's much easier. There are a set of widgets called GtkSocket and GtkPlug for this purpose. Of course the to programs doesn't need to run on the same machine. But there is always the delicate problem of getting them together in the first place.