Python Forum
[PyQt] How can I sync Combobox index to other combobox index?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[PyQt] How can I sync Combobox index to other combobox index?
#1
Hi, I have a question. I'm getting the data from the text file until the sql handles it. What I want is to return the index value of the element I selected on the ComboBox named Companies to the other boxes. In this way, the passwords of the companies etc. will also be poured onto the screen. So exactly what I want is to set the index values ​​of the selected item on the first ComboBox and the other ComboBoxes. I've done this with C#, and I'm leaving it as an example.

My Python Code:
import sys
from PyQt5 import QtWidgets
from PyQt5.QtGui import QIcon
from PyQt5.QtGui import QIcon
from AyGrupOtomasyon import Ui_MainWindow
from selenium import webdriver
import time
import os
from selenium.webdriver.common.keys import Keys
import threading


class MyApp(QtWidgets.QMainWindow):
    def __init__(self):
        super(MyApp, self).__init__()
        self.ui = Ui_MainWindow()
        self.ui.setupUi(self)
        self.ui.btn_Bildirge_2.clicked.connect(self.ButonV2Calistir)
        self.DosyaOku()

    def DosyaOku(self):
        os.chdir("Data")
        dosyaOku = open("sirket.txt", "r", encoding="utf-8")
        for i in dosyaOku:
            self.ui.cb_Firmalar.addItem(i)
        dosyaOku = open("kullanici.txt", "r", encoding="utf-8")
        for i in dosyaOku:
            self.ui.cb_Kullanici.addItem(i)
        dosyaOku = open("kod.txt", "r", encoding="utf-8")
        for i in dosyaOku:
            self.ui.cb_Kod.addItem(i)
        dosyaOku = open("isveren.txt", "r", encoding="utf-8")
        for i in dosyaOku:
            self.ui.cb_Isveren.addItem(i)
        dosyaOku = open("araci.txt", "r", encoding="utf-8")
        for i in dosyaOku:
            self.ui.cb_Araci.addItem(i)
        dosyaOku = open("sistem.txt", "r", encoding="utf-8")
        for i in dosyaOku:
            self.ui.cb_Sistem.addItem(i)
    def ButonV2Calistir(self):
        def ButonV2():
            browser = webdriver.Chrome("chromedriver.exe")
            browser.get("https://ebildirge.sgk.gov.tr/EBildirgeV2")
            var = input()
        ButonV2CalistirThread = threading.Thread(target=ButonV2)
        ButonV2CalistirThread.start()

def app():
    app = QtWidgets.QApplication(sys.argv)
    app.setStyle('Fusion')
    win = MyApp()
    win.show()
    sys.exit(app.exec_())

app()
C# Code:

KullaniciList.SelectedIndex = SirketList.SelectedIndex;
kodList.SelectedIndex = SirketList.SelectedIndex;
sistemList.SelectedIndex = SirketList.SelectedIndex;
isverenList.SelectedIndex = SirketList.SelectedIndex;
ListAraci.SelectedIndex = SirketList.SelectedIndex;

[Image: Q8Y9tyR]
Reply
#2
Your code has no ComboBox and cannot be executed because AyGrupOtomasyon is missing.
Reply
#3
You can try something like

ListAraci.setCurrentIndex(SirketList.currentIndex())
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  combobox paulie70 3 972 May-19-2023, 06:25 PM
Last Post: deanhystad
  event driven coding PyQt6 on Combobox change merrittr 3 2,088 May-03-2023, 03:35 AM
Last Post: merrittr
  [PyQt] Help Iterating through to read comboBox Selections Extra 3 1,603 Aug-01-2022, 06:56 PM
Last Post: deanhystad
  [PyQt] [Solved]Populate ComboBox with for loop? Extra 3 2,156 Jul-31-2022, 09:01 PM
Last Post: Extra
  [PyQt] [Solved]Help Adding Sql Results in ComboBox Extra 2 1,255 Jul-07-2022, 09:46 PM
Last Post: Extra
  [Tkinter] Combobox menator01 1 1,180 Apr-18-2022, 04:43 AM
Last Post: deanhystad
  Problems with ValueMember vs DisplayMember with combobox dford 7 2,373 Feb-23-2022, 11:05 PM
Last Post: deanhystad
  [Tkinter] text get index problem philipbergwerf 2 1,805 Feb-03-2022, 01:17 AM
Last Post: philipbergwerf
  Problems getting tk Combobox contents to populate properly dford 4 3,839 Jan-08-2022, 02:39 PM
Last Post: dford
  How add button to certain TAB using TAB-index MacTommu 3 3,749 Sep-23-2021, 05:53 AM
Last Post: MacTommu

Forum Jump:

User Panel Messages

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