Unsolved How to zoom in/out all widgets in a GUI?
-
This post is deleted! -
@yohana
Gosh! I don't know what you've done here :) But if you detect a zoom on a widget, why notemit()
a signal with its zoom level and the other widgets can have a slot on that to set their own zoom level the same?Unless you can just detect the zoom outside the widget and then just call to zoom the others.
-
@JonB Thanks a lot for your reply! You are right, this got too complicated...
After reading your reply I have tried your suggestion. When I detect the zoom through zoomable(self.img1), I connect it to a slot (I created the function zoom_img1_detected) and I pass the parameters scalx and scaly. Since I do this inside the function image_Widget1 I get the error AttributeError: 'main_GUI' object has no attribute 'scalx' because scalx is defined in zoomable(), which belongs to a different class than main_GUI :( -
@yohana
I do not hear a mention of creating your own new signal for this and.emit()
-ing it, and how youconnect()
that signal.I don't want to discourage you, but from your code it looks to me like your Python is all over the place. You have
def zoomable
method embedding aclass Filter(QtCore.QObject)
declaration which then goes on to have its owndef eventFilter
embedded method. I have no idea what/why you are trying to achieve here, but it would not surprise me if that leads to all sorts of problems like you report.I am not going to correct your code, but unless you have some deep reason this does not sound right at all. You may want to look at what you are doing from a Python point of view. I would have thought you should have no nested classes within
def
methods. Perhaps if you start by sorting all of that out things will fall into place more....