0

I've got this cool widget I'm working on and I simply want to paint this central straight line, over the slider widget that I've created.

enter image description here

Since the PaintEvent activates at initialization, anything called in the main class is displayed above the painted lines. With this in mind, can I call a paintevent function to initialize after my slider widgets have already been called/initialized?

Moreover, would it be smart to use threading.event() to stall the paint event function until after these sliders have been called, when I set the event?

Any advice would be great

enter image description here

*** UPDATE ***

event.is_set() blocking doesn't have an effect and the painter still paints below the QAbstractSlider

Magic Dave
  • 11
  • 3
  • I'm afraid that you're pretty confused about how widget painting works. For starters, using a blocking function/loop won't solve anything, on the contrary: it can potentially completely freeze the program, as it will prevent *any* event processing, including painting of other widgets, until that function returns or the loop exits. Also, painting always happen in the main thread, and is *not* concurrent. I suggest you to [edit] your question and provide a [mre] so that we can clarify your doubts based on an existing code you're familiar with. – musicamante Aug 04 '22 at 20:08
  • @musicamante I have added some code, but I have to note that I was blocking until a point after several functions had been called, then setting the event, but never clearing it – Magic Dave Aug 04 '22 at 20:41
  • Please ensure that your code is *actually* minimal *and* reproducible. Remove anything that's unnecessary but still ensure that it can be run. – musicamante Aug 04 '22 at 20:56
  • Besides, are you using two separate PathSlider widgets because you can have other shapes or, maybe, you could have a different count of those widgets with different paths? Because if you intend that MainWidget as a single widget that will always have the same shapes and paths, there's little point in having two widgets. It also seems really unnecessary to subclass QAbstractSlider since you're using almost no feature of that class, except for the minimum/maximum/value properties and, possibly, the mouse wheel management. – musicamante Aug 04 '22 at 21:38

0 Answers0