Python Forum
[PyQt] QLinearGradient Banding
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[PyQt] QLinearGradient Banding
#1
Hi,

I am creating an application with PyQt5. I originally was using an image for the background of my program that has the correct gradient however recently wanted to make the interface dynamic/re-sizable.

To create and set the gradient, in the main window, I am using:

p = QPalette()
gradient = QLinearGradient(0, 0, 300, 400)
gradient.setColorAt(1.0, QColor(26, 29, 32))
gradient.setColorAt(0.0, QColor(39, 44, 49))
p.setBrush(QPalette.Window, QBrush(gradient))
self.setPalette(p)
The gradient however has banding between colours, it's not massively obvious in this picture but definitely present. I imagine it has something to do with colour depth but am unsure how to fix the issue.

[Image: 2mriaAr.png]
Reply
#2
There does not seems to be any methods that address this specifically, perhaps you can try to change the Coordinate mode ?
Reply
#3
The coordinate mode just changes the method in which you specify the gradient coordinates. I think the gradient would need some form of dithering, I can't find anything in PyQt to do this though.
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020