+ 5

Is this correct to check if background color is 'lightskyblue' in python tkinter?

if(self.slider2.config.bg=='lightskyblue'):

2nd Jul 2019, 9:57 AM
Zhenis Otarbay
Zhenis Otarbay - avatar
3 odpowiedzi
+ 2
Try like this: if(self.slider2.config()['background'][4]=='lightskyblue'):
2nd Jul 2019, 11:06 AM
Tibor Santa
Tibor Santa - avatar
+ 3
@Tibor Santa, why [4]?
2nd Jul 2019, 11:42 AM
Zhenis Otarbay
Zhenis Otarbay - avatar
+ 1
config() without arguments, returns a dictionary of all attributes. Each dictionary value is a tuple... I tested and figured the value is the 5th element of this tuple, hence [4]
2nd Jul 2019, 11:59 AM
Tibor Santa
Tibor Santa - avatar