I'd like to operate QcomboBox as an IF statement.

Asked 2 years ago, Updated 2 years ago, 59 views

For example, if there is Naver and Daum in QcomboBox,

 if comboBox.currentText() = 'Naver' 
        driver = uc.Chrome()
        url = 'http://naver.com'
        driver.get(url)

    if comboBox.currentText() = 'Next' 
        driver = uc.Chrome()
        url = 'http://daum.net'
        driver.get(url)

I want to do it like this, but no matter what tag I put in the currentText() place,

It's not working.

I am looking for a teacher who will be a light to me who is lacking.

pyside2 python

2022-09-20 10:18

1 Answers

# if comboBox.currentText() = 'Naver' 
if comboBox.currentText() == 'Naver':
        driver = uc.Chrome()
        url = 'http://naver.com'
        driver.get(url)

# if comboBox.currentText() = 'Next' 
if comboBox.currentText() == 'Next':
        driver = uc.Chrome()
        url = 'http://daum.net'
        driver.get(url)


2022-09-20 10:18

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.