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

Asked 1 weeks ago, Updated 1 weeks ago, 1 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


© 2022 pinfo. All rights reserved.