As I was looking into the widget creations tutorial in wxpython. I saw that all of them has the window look but I want a widget like the one you can see on windows 7 (clock widget etc.) or like the one advanced systemcare has.
So my question how can I make such a widget in wxpython if I can at all?
wxPython will look like the OS's native widgets. If you need to do something more advanced, then you'll have to write your own widget. There are lots of examples of custom widgets included with wxPython. Take a look at anything in wx.lib.agw. All of those are custom made widgets, written in Python.
Here are a couple of other links:
http://wiki.wxpython.org/CreatingCustomControls
http://zetcode.com/wxpython/customwidgets/
Related
Is there some way I can create custom styles in wxPython? I searched all the docs and websites referring to wxPython styling and could find nothing. Do I have to create the custom style using the wxPython canvas?
wxPython uses native widgets in its core widgets as much as possible. Most of the widgets are going to be "native" to the system you are using, so unfortunately you can't fully manipulate how the control paints itself.
Sometimes, you can modify widgets via the methods mentioned in the documentation, such as using SetBackgroundColour() or SetForegroundColour(). Depending on your OS's widget, they may or may not work.
The other option is to use the wx.PaintDC, wx.ClientDC, wx.WindowDC, wx.ScreenDC and/or wx.MemoryDC to draw custom widgets directly.
I'm searching for a tkinter custom widget collection that I can include in a application designer I'm writing in 100% Python but haven't had much luck yet. I figured out a way to do a table for instance, but would like to save myself the work if there's a good implementation out there.
I found a couple of packages for pure Python custom widget creation with a little more searching online. One is Python megawidgets, at pmw.sourceforge.net, which, according to their documentation:
"is a toolkit for building high-level compound widgets in Python using the Tkinter module. It consists of a set of base classes and a library of flexible and extensible megawidgets built on this foundation. These megawidgets include notebooks, comboboxes, selection widgets, panes widgets, scrollable widgets, and dialog windows."
A different approach is writing custom widgets yourself using the Widget Construction Kit, at effbot.org/zone/wck.htm. This provides a base Widget class with primitive drawing methods, such as for borders, text, and colors, along with a basic but complete set of event definitions for binding your event handlers to your custom widgets. It has some good advice on doing animated widgets, such as drag and drop.
If anybody knows of any other packages of widgets or construction toolkit APIs, feel free to post it here. Developers will appreciate having a larger selection in a single location.
Background:
In recent days I've been experimenting with building many ordinary widgets from scratch in wxPython using the PyControl method of building custom controls as a personal challenge. However, I've hit issues when building a custom menu widget. By this I mean I am envisaging a button that when clicked on yields a drop down menu of options/commands etc.
Question:
What is the best way of achieving a completely custom menu widget in wxPython? Ideally I'd like to use only original code (i.e. as much as possible handled directly in the code). An ideal answer would include a runnable code snippet if possible.
Thanks for any help!
I am trying to write a custom widget for the Qt Designer using only Python. I was following a couple of tutorials I found online but none of them were working or anything close to what I would call to be a minimum working example.
So my questions are:
What steps are involved to make a a custom widget appear in the Widget Box of Qt Designer?
If you can spare the time: Please provide a minimum working example (like a widget with a label in it saying "A truly minimal working Qt custom widget example").
Or is it maybe not possible at all to include a custom widget using only python?
There are very few examples available on how to make a custom widget in pyqt. I wrote this article with a working example: Making a Custom Widget in PyQt
Here is the answer to your question #3: How do I use promote to in Qt Designer in pyqt4?
I am using PySide and it works the same way. This method works directly with your Python custom widget code. You do not need to write any separate plugin code.
After you have promoted your custom widget, you can right click on it and add your signals with "Change signals/slots..."
I would recommend putting all you widgets in a YourCostumWidgetsPack.UI file, and then when you load this file in Qt Designer, in addition to the UI you are working. It will load all your custom widget information.
I found this article to be your answer: https://doc.qt.io/archives/qq/qq26-pyqtdesigner.html
But, I haven't been able to install it in Qt Designer though :D
Here is an image of what I am looking for
The best i have found is a popup box.
It would be good if the widget was intended to be used in TextBoxes.
It sounds like you want a text control that has autocomplete. You should take a look at this wxPython wiki recipe:
http://wiki.wxpython.org/TextCtrlAutoComplete
That should get you started.