Overloading virtual method of widget without inheriting (PyQt)

Diez B. Roggisch deets at nospam.web.de
Tue May 27 05:47:07 EDT 2008


Alex Gusarov wrote:

>>    class MyPaintCell(PaintCell):
>>       def paintcell(self):
>>           PaintCell.paintcell(self)
>>           myPaintCell(self)
>>
>>    (hmm, only 4 lines, I overestimated the cost. Sorry)
> 
> Yeah, that's funny..
> 
> I don't want to do it 'cause I create my form within Designer and
> simply drop Calendar widget to it. Then I need to translate it
> into .py file, it's OK. But if I want to use a custom derived from
> Calendar class instead of it, I need after every refreshing/
> translating of form replace few lines in translated file.
> 
> I just want to know about existence of other method to do this in
> class, that contain instance of Calendar.
> 
> By "this" I mean:
> Instead of calling original method "paintcell" alone, call it with my
> custom metod.

You should ask this on the PyQt-mailing-list. And you can try and experiment
with the module new & the function instancemethod in there.

Diez



More information about the Python-list mailing list