# стилизуем через f строки, передавая цвета как аргументы
self.pushButton.setStyleSheet("QPushButton{\n"
" border-radius: 30px;\n"
f" border: 2px solid {color_1};\n"
f" background-color: {color_2};\n"
"}")
# добавляем аргументы в setupUi
def setupUi(self, MainWindow, color_1, color_2):
# если форма как отдельный модуль
import your_form
self.form = your_form.class_name()
# если в одном файле
self.form = class_name()
# вызываем форму с новыми цветами
def function(self):
self.form.setupUi(self, "rgb(255,0,0)", "rgb(255,0,0)")
self.show()
self.form.fishing_0.clicked.connect(function)
def start_city_bilgewater_info(self):
self.ui_city_info.setupUi(self, "BILGEWATER_BACK", "BILGEWATER_BACKGROUND", "BILGEWATER_3D")
self.ui_city_info.pb_cancel_city_info.clicked.connect(self.start_map)
with sqlite3.connect('database/database.db') as db:
cursor = db.cursor()
cursor.execute("SELECT * FROM cities_info WHERE id = %d" % 2)
result = cursor.fetchone()
self.ui_city_info.l_city_name.setText(str(result[1]))
self.ui_city_info.l_city_s_name.setText(str(result[2]))
self.ui_city_info.l_city_edit_info_1.setText(str(result[3]))
self.ui_city_info.l_city_edit_info_2.setText(str(result[4]))
self.ui_city_info.l_city_edit_info_3.setText(str(result[6]))
self.ui_city_info.l_city_edit_info_4.setText(str(result[5]))
self.ui_city_info.l_city_edit_info_5.setText(str(result[7]))
cursor.close()
db.close()
self.show()