Python ObjectListView add animation when the list is empty - python

Right now, I am writing a python program using ObjectListView package. When the list is empty, the back ground will show words "This list is empty". But I want to change it into an animation. How to realize it?
Do I have to change the ObjectListView library to realize it?

"This list is empty" is shown in a StaticText control (named stEmptyListMsg). You can change the message and the font by calling SetEmptyListMsg and SetEmptyListMsgFont respectively.
If you want to replace the StaticText with an animation, then, I think, you should write your own custom ListCtrl based on ObjectListView or ListCtrl.
This link can help you to create an animation: http://www.daniweb.com/software-development/python/code/216673/wxpython-animated-gif#

Related

wxpython bitmap adding textctrl/combobox top of it?

I was trying to find if its possible to add textctrl/combobox top of GenStaticBitmap in wxpython.
Did not find anything with the fast searches i did. Its not first in the priorities, but i feel like it would make the program usage better.
In this case i have screenshot taken from webpage and user can select inputbox and it should be textctrl over the bitmap positioned where it was selected. (i have it working already with textctrl positioned elsewhere).
# example something like this
self.staticbitmap = GenStaticBitmap(self.panel, self.bitmap)
text = wx.textctrl(self.panel)
# Have sizer position it here?
I can not give full code example.
Are you searching for something like a background bitmap (controls on top of a user-defined bitmap)?
Mike Driscoll has described a solution for this in his Blog.

Gtk HeaderBar doesn't expand children

I'm using Gtk to build an application on Linux using Python 3. I'm trying to use a Gtk.HeaderBar. So far it's been working Ok, but it seems that I can't get it to expand it's child widgets. For example:
As you can see above, I've tried putting my Gtk.Entry into the Gtk.HeaderBar, but even with things like Gtk.Entry.set_hexpand(True) it simply refuses to expand. I've even tried putting it inside a Gtk.Box, expanding the Gtk.Box, then adding the Gtk.Entry inside that. Even when I set the Gtk.Entry as a custom title for the Gtk.HeaderBar, this happens:
What's causing this? How can I fix it?
Enabling hexpand only says that you want the widget to be allocated all the remaining space; it does not actually resize your widget. You want the halign property set to GTK_ALIGN_FILL (or whatever it's called in Python) in addition to hexpand.
Check the diagrams on this page for a visual explanation.
You can use Box instead of Headerbar with window.set_titlebar method

fastest way to change texte appearance in a QTextEdit object

For a Python3/PyQt4 project, I'm looking for the fastest way to change the text appearance of several words in a QTextEdit object. The text is not written in HTML (it's a pure text string), is read-only and is made of several words. Each word has a special 'attribute' defined in my code, defining its appearance when this word is hovered over.
The appearance of all words sharing the same attribute must change when one of these words is hovered over.
I need speed since :
I did more or less the same program but the the words' appearance changed when the user clicked on them and I guess my code is too slow to be used with hover events. (see details below)
It's a Python project based on PyQt4, not a C++ one based on Qt.
Any help would be appreciated !
MORE DETAILS :
I can see two ways to achieve my goal :
(1) Write my text in the editor, detect which word the mouse "flies over", get the other words to be highlighted and painfully select them, one by one, inserting some HTML code to modify their appearance. It's the painfully part that I find too complex and too slow : is there a fastest way to do this ?
(2) Writing my text as an HTML one and work with the CSS since a QTextEditor can use them. Alas, the easy way can't work. But perhaps is it possible to "re-load" the CSS of the text and use a more clever trick ?
I'm wondering is it even possible to get the word under mouse cursor from the QTextEdit.
You said the text cannot be edited, so I maybe the QTextEdit is not the best possible widget for this job. Create your own widget and draw the text by yourself. Then you know the word positions so finding the word under the mouse is easy. And when some attribute is activated or deactivated, you can redraw only the affected words.

tkinter forced indent

I am looking for help - I am updating my Tkinter wiki (http://sourceforge.net/projects/infolder/) trying to add to it some folding/outline capabilities.
For it to work I need to place in the text widget (the main window where all the action happens) some un-deletable symbol indicating folding (e.g. a small triangle image indicating hidden text lines).
Unfortunately I noticed from these Q&A's that undeletable stuff is not easy to create in Tkinter:
How can you mark a portion of a text widget as readonly?
unremovable text in tkinter
As a 2nd option, I could try to show folding levels by a forced indent, so that e.g. if I'm at a one-level deep, the start-of-line is not at column 1 but at column 5...
This is it possible in Tkinter, without too much work?
thanks for any help...
Your question says that undeleteable regions are "not easy", but you also show they are possible by linking to an answer that shows how. So, what question are you asking?
As for "forced indent", look at the lmargin1 and lmargin2 tag attributes.

How do I get rid of the arrow in a Tix.Balloon widget?

When I use the standard Tix.Balloon widget, bind it to a button and use a balloonmsg, I get the tooltip over the button, but I also get a stupid looking arrow inside the tooltip. (See the demo code from the Python source tree here.) Is it possible to get rid of this arrow, or do I need to use another type of widget to get a normal looking tooltip?
This will set the arrow image to a blank bitmap
b = Tix.Balloon(root)
b.subwidget('label')['image'] = Tkinter.BitmapImage()
There are two subwidgets within a balloon, label which is the arrow and message which is the text.
I'm still new to python so there might be a better way to actually remove the arrow instead of just cover it up.
I am using Python 3.2

Categories

Resources