<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[How to call QPushButton and QLineEdit from window 2]]></title><description><![CDATA[<p dir="auto">Hello, I have python app, where I wan't to add login window called from main GUI. Extra window has two QLineEdit fields and one QPushButton. Now I can succesfully call login window with button from main GUI, but I don't know how to access button and lineedits from login window. Becouse of a very big amounth of the code I will post only parts of the code of <a href="http://main.py" target="_blank" rel="noopener noreferrer nofollow ugc">main.py</a> and <a href="http://gui.py" target="_blank" rel="noopener noreferrer nofollow ugc">gui.py</a> and complete code of login_window.py. Hope that explanation is satisfying.</p>
<p dir="auto">Regards, Vlado</p>
<p dir="auto"><a href="http://main.py" target="_blank" rel="noopener noreferrer nofollow ugc">main.py</a>:</p>
<pre><code>...
master.pushButton_Login.clicked.connect(master.open_Login_Window)
...
</code></pre>
<p dir="auto"><a href="http://gui.py" target="_blank" rel="noopener noreferrer nofollow ugc">gui.py</a>:</p>
<pre><code>from PyQt5 import QtCore, QtGui, QtWidgets

from login_window import Ui_Dialog

class Ui_SCADA(object):
    def open_Login_Window(self):    
        self.window = QtWidgets.QDialog()
        self.ui = Ui_Dialog()
        self.ui.setupUi(self.window)        
        self.window.show()
        
    def setupUi(self, SCADA):
        SCADA.setObjectName("SCADA")
        SCADA.resize(888, 665)
</code></pre>
<p dir="auto">login_window.py:</p>
<pre><code>from PyQt5 import QtCore, QtGui, QtWidgets

class Ui_Dialog(object):
    def setupUi(self, Dialog):
        Dialog.setObjectName("Dialog")
        Dialog.resize(400, 300)
        self.bgwidget = QtWidgets.QWidget(Dialog)
        self.bgwidget.setGeometry(QtCore.QRect(-1, -1, 401, 301))
        self.bgwidget.setStyleSheet("QWidget#bgwidget{\n"
"background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:1, stop:0 rgba(0, 0, 0, 255), stop:1 rgba(255, 255, 255, 255));}")
        self.bgwidget.setObjectName("bgwidget")
        self.label = QtWidgets.QLabel(self.bgwidget)
        self.label.setGeometry(QtCore.QRect(160, 30, 91, 31))
        font = QtGui.QFont()
        font.setPointSize(20)
        self.label.setFont(font)
        self.label.setStyleSheet("color: rgb(255, 255, 127);")
        self.label.setObjectName("label")
        self.pushButton_prijava = QtWidgets.QPushButton(self.bgwidget)
        self.pushButton_prijava.setGeometry(QtCore.QRect(140, 230, 121, 30))
        self.pushButton_prijava.setStyleSheet("color: rgb(255, 255, 127);\n"
"background-color: rgb(99, 99, 99);")
        self.pushButton_prijava.setObjectName("pushButton_prijava")
        self.lineEdit_user_name = QtWidgets.QLineEdit(self.bgwidget)
        self.lineEdit_user_name.setGeometry(QtCore.QRect(140, 110, 121, 30))
        self.lineEdit_user_name.setObjectName("lineEdit_user_name")
        self.lineEdit_password = QtWidgets.QLineEdit(self.bgwidget)
        self.lineEdit_password.setGeometry(QtCore.QRect(140, 170, 121, 30))
        self.lineEdit_password.setObjectName("lineEdit_password")
        self.label_2 = QtWidgets.QLabel(self.bgwidget)
        self.label_2.setGeometry(QtCore.QRect(60, 120, 68, 22))
        self.label_2.setStyleSheet("color: rgb(255, 255, 127);")
        self.label_2.setObjectName("label_2")
        self.label_3 = QtWidgets.QLabel(self.bgwidget)
        self.label_3.setGeometry(QtCore.QRect(60, 180, 68, 22))
        self.label_3.setStyleSheet("color: rgb(255, 255, 127);")
        self.label_3.setObjectName("label_3")

        self.retranslateUi(Dialog)
        QtCore.QMetaObject.connectSlotsByName(Dialog)

    def retranslateUi(self, Dialog):
        _translate = QtCore.QCoreApplication.translate
        Dialog.setWindowTitle(_translate("Dialog", "Dialog"))
        self.label.setText(_translate("Dialog", "Prijava"))
        self.pushButton_prijava.setText(_translate("Dialog", "Prijava"))
        self.label_2.setText(_translate("Dialog", "Up. ime"))
        self.label_3.setText(_translate("Dialog", "Geslo"))

if __name__ == "__main__":
    import sys
    app = QtWidgets.QApplication(sys.argv)
    Dialog = QtWidgets.QDialog()
    ui = Ui_Dialog()
    ui.setupUi(Dialog)
    Dialog.show()
    sys.exit(app.exec_())

</code></pre>
]]></description><link>https://forum.qt.io/topic/132316/how-to-call-qpushbutton-and-qlineedit-from-window-2</link><generator>RSS for Node</generator><lastBuildDate>Thu, 22 Oct 2026 17:54:26 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/132316.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 25 Nov 2021 19:18:27 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to How to call QPushButton and QLineEdit from window 2 on Sat, 27 Nov 2021 20:30:39 GMT]]></title><description><![CDATA[<p dir="auto">You can either use the "Topic Tools" button or the three dotted menu beside the answer you deem correct.</p>
]]></description><link>https://forum.qt.io/post/692052</link><guid isPermaLink="true">https://forum.qt.io/post/692052</guid><dc:creator><![CDATA[SGaist]]></dc:creator><pubDate>Sat, 27 Nov 2021 20:30:39 GMT</pubDate></item><item><title><![CDATA[Reply to How to call QPushButton and QLineEdit from window 2 on Sat, 27 Nov 2021 08:24:44 GMT]]></title><description><![CDATA[<p dir="auto">Thanks man for showing me the way, it works now. All "Log IN" actions were put into <a href="http://logwindow.py" target="_blank" rel="noopener noreferrer nofollow ugc">logwindow.py</a> and called from there.<br />
How can I mark this post as solved?</p>
<p dir="auto">Regards, Vlado</p>
]]></description><link>https://forum.qt.io/post/691984</link><guid isPermaLink="true">https://forum.qt.io/post/691984</guid><dc:creator><![CDATA[California]]></dc:creator><pubDate>Sat, 27 Nov 2021 08:24:44 GMT</pubDate></item><item><title><![CDATA[Reply to How to call QPushButton and QLineEdit from window 2 on Fri, 26 Nov 2021 19:51:17 GMT]]></title><description><![CDATA[<p dir="auto">Make a proper widget of your login dialog and use it at the right place in your main window.</p>
]]></description><link>https://forum.qt.io/post/691958</link><guid isPermaLink="true">https://forum.qt.io/post/691958</guid><dc:creator><![CDATA[SGaist]]></dc:creator><pubDate>Fri, 26 Nov 2021 19:51:17 GMT</pubDate></item><item><title><![CDATA[Reply to How to call QPushButton and QLineEdit from window 2 on Fri, 26 Nov 2021 19:24:23 GMT]]></title><description><![CDATA[<p dir="auto">First of all, thanks to all for helping ...<br />
Ok, I got one step closer...it works, but only at start up application. To represent the situation, I put together small example, which you can run...so, what to do in existing example to print both line edits content whenever is login window opened. Thanks in advance, Vlado<br />
<a href="http://main.py" target="_blank" rel="noopener noreferrer nofollow ugc">main.py</a></p>
<pre><code>import gui
import logwindow
import sys
import os

from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.QtWidgets import QMainWindow, QApplication
from PyQt5.QtCore import QTimer
import time

#------------------------------------------------------------------------------
def userName():
    un = login.lineEdit_user_name.text()
    print(un)
    return un

def passWord():
    pw = login.lineEdit_password.text()
    print(pw)
    return pw

def log_IN():
    userName()
    passWord()

def show_login_window():  
    log_IN()
    print("-------")
#-----------------------------------------------------------------------------
def push_buttons():
    master.pushButton_call_window.clicked.connect(master.open_Login_Window)
    login.pushButton_Login.clicked.connect(show_login_window)
#---------------------------------------------------------------------------------
def triger():
    push_buttons()  


if __name__ == "__main__":
    app = QtWidgets.QApplication(sys.argv)
    gui_master = gui.QtWidgets.QWidget()
    master = gui.Ui_Form()
    master.setupUi(gui_master)

    gui_login = logwindow.QtWidgets.QDialog()
    login = logwindow.Ui_Dialog()
    login.setupUi(gui_login)
    
    timer = QTimer()
    timer.timeout.connect(triger)  
    timer.start(1000)

    gui_master.show()
    gui_login.show()
    sys.exit(app.exec_())
</code></pre>
<p dir="auto"><a href="http://gui.py" target="_blank" rel="noopener noreferrer nofollow ugc">gui.py</a></p>
<pre><code>from PyQt5 import QtCore, QtGui, QtWidgets

from logwindow import Ui_Dialog

class Ui_Form(object):
    def open_Login_Window(self):    
        self.window = QtWidgets.QDialog()
        self.ui = Ui_Dialog()
        self.ui.setupUi(self.window)        
        self.window.show()
        
    def setupUi(self, Form):
        Form.setObjectName("Form")
        Form.resize(400, 300)
        self.pushButton_call_window = QtWidgets.QPushButton(Form)
        self.pushButton_call_window.setGeometry(QtCore.QRect(130, 130, 141, 30))
        self.pushButton_call_window.setObjectName("pushButton_call_window")

        self.retranslateUi(Form)
        QtCore.QMetaObject.connectSlotsByName(Form)

    def retranslateUi(self, Form):
        _translate = QtCore.QCoreApplication.translate
        Form.setWindowTitle(_translate("Form", "Form"))
        self.pushButton_call_window.setText(_translate("Form", "Call Login Window"))


if __name__ == "__main__":
    import sys
    app = QtWidgets.QApplication(sys.argv)
    Form = QtWidgets.QWidget()
    ui = Ui_Form()
    ui.setupUi(Form)
    Form.show()
    sys.exit(app.exec_())
</code></pre>
<p dir="auto"><a href="http://logwindow.py" target="_blank" rel="noopener noreferrer nofollow ugc">logwindow.py</a></p>
<pre><code># -*- coding: utf-8 -*-

# Form implementation generated from reading ui file 'logwindow.ui'
#
# Created by: PyQt5 UI code generator 5.15.2
#
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again.  Do not edit this file unless you know what you are doing.


from PyQt5 import QtCore, QtGui, QtWidgets


class Ui_Dialog(object):
    def setupUi(self, Dialog):
        Dialog.setObjectName("Dialog")
        Dialog.resize(400, 300)
        self.pushButton_Login = QtWidgets.QPushButton(Dialog)
        self.pushButton_Login.setGeometry(QtCore.QRect(140, 200, 91, 30))
        self.pushButton_Login.setObjectName("pushButton_Login")
        self.lineEdit_user_name = QtWidgets.QLineEdit(Dialog)
        self.lineEdit_user_name.setGeometry(QtCore.QRect(130, 70, 113, 30))
        self.lineEdit_user_name.setObjectName("lineEdit_user_name")
        self.lineEdit_user_name.setText("user name")
        self.lineEdit_password = QtWidgets.QLineEdit(Dialog)
        self.lineEdit_password.setGeometry(QtCore.QRect(130, 120, 113, 30))
        self.lineEdit_password.setObjectName("lineEdit_password")
        self.lineEdit_password.setText("password")

        self.retranslateUi(Dialog)
        QtCore.QMetaObject.connectSlotsByName(Dialog)

    def retranslateUi(self, Dialog):
        _translate = QtCore.QCoreApplication.translate
        Dialog.setWindowTitle(_translate("Dialog", "Dialog"))
        self.pushButton_Login.setText(_translate("Dialog", "Login"))


if __name__ == "__main__":
    import sys
    app = QtWidgets.QApplication(sys.argv)
    Dialog = QtWidgets.QDialog()
    ui = Ui_Dialog()
    ui.setupUi(Dialog)
    Dialog.show()
    sys.exit(app.exec_())

</code></pre>
]]></description><link>https://forum.qt.io/post/691957</link><guid isPermaLink="true">https://forum.qt.io/post/691957</guid><dc:creator><![CDATA[California]]></dc:creator><pubDate>Fri, 26 Nov 2021 19:24:23 GMT</pubDate></item><item><title><![CDATA[Reply to How to call QPushButton and QLineEdit from window 2 on Fri, 26 Nov 2021 11:33:05 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/california">@<bdi>California</bdi></a> You simply call these methods as you would do with any other method (also <a class="plugin-mentions-user plugin-mentions-a" href="/user/sgaist">@<bdi>SGaist</bdi></a> already shown how):</p>
<pre><code>def open_Login_Window(self):    
        self.window = QtWidgets.QDialog()
        self.ui = Ui_Dialog()
        self.ui.setupUi(self.window)        
        self.window.show()  
        ...
        name = self.ui.user_Name()
        password = self.ui.pass_Word()
</code></pre>
<p dir="auto">You also should use exec() instead of show() I think.</p>
]]></description><link>https://forum.qt.io/post/691898</link><guid isPermaLink="true">https://forum.qt.io/post/691898</guid><dc:creator><![CDATA[jsulm]]></dc:creator><pubDate>Fri, 26 Nov 2021 11:33:05 GMT</pubDate></item><item><title><![CDATA[Reply to How to call QPushButton and QLineEdit from window 2 on Fri, 26 Nov 2021 10:29:51 GMT]]></title><description><![CDATA[<p dir="auto">I couldnt imagine, ading extra window for log in could make so big troubles for me.<br />
I'ii post top parts of the code for modules: <a href="http://main.py" target="_blank" rel="noopener noreferrer nofollow ugc">main.py</a>, gui_91.py and login_window.py so you can get the picture, couse obviously I can't explain correct what I would like to do. There are some other modules involved, but they are not important for description of my problem. Thanks for all your help and please forgive me my poor knowledge, programming is my free time pleassure.</p>
<p dir="auto"><a href="http://main.py" target="_blank" rel="noopener noreferrer nofollow ugc">main.py</a>    (gui_91.py is imported here)</p>
<pre><code>import RPi.GPIO as GPIO
from subprocess import call
import gui_91
import sys
import os
from datetime import datetime
from slaves import *
from Buffer_script_02 import *
from graph_08c import *  
from kalkulacije import *
from xls_store_8 import*

from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.QtWidgets import QMainWindow, QApplication
from PyQt5.QtCore import QTimer
import time

...
</code></pre>
<p dir="auto">gui_91.py      (login_window.py is imported here)</p>
<pre><code>from PyQt5 import QtCore, QtGui, QtWidgets

from login_window import Ui_Dialog

try:
    _fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
    def _fromUtf8(s):
        return s

try:
    _encoding = QtGui.QApplication.UnicodeUTF8
    def _translate(context, text, disambig):
        return QtGui.QApplication.translate(context, text, disambig, _encoding)
except AttributeError:
    def _translate(context, text, disambig):
        return QtGui.QApplication.translate(context, text, disambig)

class Ui_SCADA(object):
    
    #-----------------------------------------------------------------------------------------------
    def open_Login_Window(self):    
        self.window = QtWidgets.QDialog()
        self.ui = Ui_Dialog()
        self.ui.setupUi(self.window)        
        self.window.show()  
    #-----------------------------------------------------------------------------------------------
        
    def setupUi(self, SCADA):
        SCADA.setObjectName("SCADA")
        SCADA.resize(888, 665)

...
</code></pre>
<p dir="auto">login_window.py    (I want to use methods "user_Name" and "pass_Word" in <a href="http://main.py" target="_blank" rel="noopener noreferrer nofollow ugc">main.py</a> or in gui_91.py)</p>
<pre><code># -*- coding: utf-8 -*-

# Form implementation generated from reading ui file 'login.ui'
#
# Created by: PyQt5 UI code generator 5.15.2
#
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again.  Do not edit this file unless you know what you are doing.


from PyQt5 import QtCore, QtGui, QtWidgets

try:
    _fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
    def _fromUtf8(s):
        return s

try:
    _encoding = QtGui.QApplication.UnicodeUTF8
    def _translate(context, text, disambig):
        return QtGui.QApplication.translate(context, text, disambig, _encoding)
except AttributeError:
    def _translate(context, text, disambig):
        return QtGui.QApplication.translate(context, text, disambig)

class Ui_Dialog(object):
    def user_Name(self):
        un = self.lineEdit_user_name.text()
        print(un)
        return un

    def pass_Word(self):
        pw = self.lineEdit_password.text()
        print(pw)
        return pw
    
    def log_IN(self):
        print("Log In")
        self.user_Name()
        self.pass_Word()
        
    def setupUi(self, Dialog):
        Dialog.setObjectName("Dialog")
        Dialog.resize(400, 300)
        self.bgwidget = QtWidgets.QWidget(Dialog)
        self.bgwidget.setGeometry(QtCore.QRect(-1, -1, 401, 301))
        self.bgwidget.setStyleSheet("QWidget#bgwidget{\n"
"background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:1, stop:0 rgba(0, 0, 0, 255), stop:1 rgba(255, 255, 255, 255));}")
        self.bgwidget.setObjectName("bgwidget")
        self.label = QtWidgets.QLabel(self.bgwidget)
        self.label.setGeometry(QtCore.QRect(160, 30, 91, 31))
        font = QtGui.QFont()
        font.setPointSize(20)
        self.label.setFont(font)
        self.label.setStyleSheet("color: rgb(255, 255, 127);")
        self.label.setObjectName("label")
        #self.pushButton_Log_in = QtWidgets.QPushButton(self.bgwidget)
        self.pushButton_Log_in = QtWidgets.QPushButton(self.bgwidget, clicked = lambda: log_IN())
        self.pushButton_Log_in.setGeometry(QtCore.QRect(140, 230, 121, 30))
        self.pushButton_Log_in.setStyleSheet("color: rgb(255, 255, 127);\n"
"background-color: rgb(99, 99, 99);")
        self.pushButton_Log_in.setObjectName("pushButton_Log_in")
        self.lineEdit_user_name = QtWidgets.QLineEdit(self.bgwidget)
        self.lineEdit_user_name.setGeometry(QtCore.QRect(140, 110, 121, 30))
        self.lineEdit_user_name.setObjectName("lineEdit_user_name")
        self.lineEdit_password = QtWidgets.QLineEdit(self.bgwidget)
        self.lineEdit_password.setGeometry(QtCore.QRect(140, 170, 121, 30))
        self.lineEdit_password.setObjectName("lineEdit_password")
        self.label_2 = QtWidgets.QLabel(self.bgwidget)
        self.label_2.setGeometry(QtCore.QRect(60, 120, 68, 22))
        self.label_2.setStyleSheet("color: rgb(255, 255, 127);")
        self.label_2.setObjectName("label_2")
        self.label_3 = QtWidgets.QLabel(self.bgwidget)
        self.label_3.setGeometry(QtCore.QRect(60, 180, 68, 22))
        self.label_3.setStyleSheet("color: rgb(255, 255, 127);")
        self.label_3.setObjectName("label_3")

        self.retranslateUi(Dialog)
        QtCore.QMetaObject.connectSlotsByName(Dialog)

    def retranslateUi(self, Dialog):
        _translate = QtCore.QCoreApplication.translate
        Dialog.setWindowTitle(_translate("Dialog", "Dialog"))
        self.label.setText(_translate("Dialog", "Prijava"))
        self.pushButton_Log_in.setText(_translate("Dialog", "Prijava"))
        self.label_2.setText(_translate("Dialog", "Up. ime"))
        self.label_3.setText(_translate("Dialog", "Geslo"))


if __name__ == "__main__":
    import sys
    app = QtWidgets.QApplication(sys.argv)
    Dialog = QtWidgets.QDialog()
    ui = Ui_Dialog()
    ui.setupUi(Dialog)
    Dialog.show()
    sys.exit(app.exec_())

</code></pre>
]]></description><link>https://forum.qt.io/post/691893</link><guid isPermaLink="true">https://forum.qt.io/post/691893</guid><dc:creator><![CDATA[California]]></dc:creator><pubDate>Fri, 26 Nov 2021 10:29:51 GMT</pubDate></item><item><title><![CDATA[Reply to How to call QPushButton and QLineEdit from window 2 on Fri, 26 Nov 2021 09:06:47 GMT]]></title><description><![CDATA[<pre><code>Dialog.exec_()
print(Dialog.user_Name()
</code></pre>
<p dir="auto">Please use proper casing for your method, variable and class names. Although it doesn't matter for your machine, the humans reading your code will have a very hard time.</p>
<p dir="auto">Follow the <a href="https://www.python.org/dev/peps/pep-0008/" target="_blank" rel="noopener noreferrer nofollow ugc">PEP8 document</a></p>
<ul>
<li>Variable names in lower case</li>
<li>function name in snake_case, no uppercase mixed in there</li>
</ul>
<p dir="auto">Qt uses camelCase for its functions because they come from the C++ style guide lines they are using although you can change that with the <a href="https://doc.qt.io/qtforpython/considerations.html#snake-case" target="_blank" rel="noopener noreferrer nofollow ugc">latest version of PySide6</a>.</p>
<p dir="auto">Beside that, since as you said you are a beginner, you should take the time to read the documentation and tutorials provided by Qt's documentation. You'll learn quite a lot there to get the basics going properly.</p>
]]></description><link>https://forum.qt.io/post/691880</link><guid isPermaLink="true">https://forum.qt.io/post/691880</guid><dc:creator><![CDATA[SGaist]]></dc:creator><pubDate>Fri, 26 Nov 2021 09:06:47 GMT</pubDate></item><item><title><![CDATA[Reply to How to call QPushButton and QLineEdit from window 2 on Fri, 26 Nov 2021 08:57:44 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/california">@<bdi>California</bdi></a> said in <a href="/post/691874">How to call QPushButton and QLineEdit from window 2</a>:</p>
<blockquote>
<p dir="auto">but how to pass variable un into main?</p>
</blockquote>
<p dir="auto">Please explain better.<br />
What variable and what is "main"?</p>
]]></description><link>https://forum.qt.io/post/691876</link><guid isPermaLink="true">https://forum.qt.io/post/691876</guid><dc:creator><![CDATA[jsulm]]></dc:creator><pubDate>Fri, 26 Nov 2021 08:57:44 GMT</pubDate></item><item><title><![CDATA[Reply to How to call QPushButton and QLineEdit from window 2 on Fri, 26 Nov 2021 08:55:56 GMT]]></title><description><![CDATA[<p dir="auto">Thanks for help.<br />
Ok, for my knowledge is quite big chalenge. It works now in second window (code below), but how to pass variable un into main?</p>
<pre><code># -*- coding: utf-8 -*-

# Form implementation generated from reading ui file 'login.ui'
#
# Created by: PyQt5 UI code generator 5.15.2
#
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again.  Do not edit this file unless you know what you are doing.


from PyQt5 import QtCore, QtGui, QtWidgets

try:
    _fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
    def _fromUtf8(s):
        return s

try:
    _encoding = QtGui.QApplication.UnicodeUTF8
    def _translate(context, text, disambig):
        return QtGui.QApplication.translate(context, text, disambig, _encoding)
except AttributeError:
    def _translate(context, text, disambig):
        return QtGui.QApplication.translate(context, text, disambig)

class Ui_Dialog(object):
    def user_Name(self):
        un = self.lineEdit_user_name.text()
        print(un)
        return un

    def pass_Word(self):
        pw = self.lineEdit_password.text()
        print(pw)
        return pw
    
    def prijava(self):
        print("Prijava")
        self.user_Name()
        self.pass_Word()
        
    def setupUi(self, Dialog):
        Dialog.setObjectName("Dialog")
        Dialog.resize(400, 300)
        self.bgwidget = QtWidgets.QWidget(Dialog)
        self.bgwidget.setGeometry(QtCore.QRect(-1, -1, 401, 301))
        self.bgwidget.setStyleSheet("QWidget#bgwidget{\n"
"background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:1, stop:0 rgba(0, 0, 0, 255), stop:1 rgba(255, 255, 255, 255));}")
        self.bgwidget.setObjectName("bgwidget")
        self.label = QtWidgets.QLabel(self.bgwidget)
        self.label.setGeometry(QtCore.QRect(160, 30, 91, 31))
        font = QtGui.QFont()
        font.setPointSize(20)
        self.label.setFont(font)
        self.label.setStyleSheet("color: rgb(255, 255, 127);")
        self.label.setObjectName("label")
        #self.pushButton_Log_in = QtWidgets.QPushButton(self.bgwidget)
        self.pushButton_Log_in = QtWidgets.QPushButton(self.bgwidget, clicked = lambda: self.prijava())
        self.pushButton_Log_in.setGeometry(QtCore.QRect(140, 230, 121, 30))
        self.pushButton_Log_in.setStyleSheet("color: rgb(255, 255, 127);\n"
"background-color: rgb(99, 99, 99);")
        self.pushButton_Log_in.setObjectName("pushButton_Log_in")
        self.lineEdit_user_name = QtWidgets.QLineEdit(self.bgwidget)
        self.lineEdit_user_name.setGeometry(QtCore.QRect(140, 110, 121, 30))
        self.lineEdit_user_name.setObjectName("lineEdit_user_name")
        self.lineEdit_password = QtWidgets.QLineEdit(self.bgwidget)
        #self.lineEdit_password = QtWidgets.setEchoMode.QLineEdit(self.bgwidget)
        self.lineEdit_password.setGeometry(QtCore.QRect(140, 170, 121, 30))
        self.lineEdit_password.setObjectName("lineEdit_password")
        self.label_2 = QtWidgets.QLabel(self.bgwidget)
        self.label_2.setGeometry(QtCore.QRect(60, 120, 68, 22))
        self.label_2.setStyleSheet("color: rgb(255, 255, 127);")
        self.label_2.setObjectName("label_2")
        self.label_3 = QtWidgets.QLabel(self.bgwidget)
        self.label_3.setGeometry(QtCore.QRect(60, 180, 68, 22))
        self.label_3.setStyleSheet("color: rgb(255, 255, 127);")
        self.label_3.setObjectName("label_3")

        self.retranslateUi(Dialog)
        QtCore.QMetaObject.connectSlotsByName(Dialog)

    def retranslateUi(self, Dialog):
        _translate = QtCore.QCoreApplication.translate
        Dialog.setWindowTitle(_translate("Dialog", "Dialog"))
        self.label.setText(_translate("Dialog", "Prijava"))
        self.pushButton_Log_in.setText(_translate("Dialog", "Prijava"))
        self.label_2.setText(_translate("Dialog", "Up. ime"))
        self.label_3.setText(_translate("Dialog", "Geslo"))


if __name__ == "__main__":
    import sys
    app = QtWidgets.QApplication(sys.argv)
    Dialog = QtWidgets.QDialog()
    ui = Ui_Dialog()
    ui.setupUi(Dialog)
    Dialog.show()
    sys.exit(app.exec_())

</code></pre>
]]></description><link>https://forum.qt.io/post/691874</link><guid isPermaLink="true">https://forum.qt.io/post/691874</guid><dc:creator><![CDATA[California]]></dc:creator><pubDate>Fri, 26 Nov 2021 08:55:56 GMT</pubDate></item><item><title><![CDATA[Reply to How to call QPushButton and QLineEdit from window 2 on Fri, 26 Nov 2021 05:48:34 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/california">@<bdi>California</bdi></a> There is really not much to it:</p>
<pre><code>class Ui_Dialog(object):
...
    def userName(self):
        return self.lineEdit_user_name.text()
# Same for all other text edits you need
</code></pre>
]]></description><link>https://forum.qt.io/post/691847</link><guid isPermaLink="true">https://forum.qt.io/post/691847</guid><dc:creator><![CDATA[jsulm]]></dc:creator><pubDate>Fri, 26 Nov 2021 05:48:34 GMT</pubDate></item><item><title><![CDATA[Reply to How to call QPushButton and QLineEdit from window 2 on Thu, 25 Nov 2021 20:19:16 GMT]]></title><description><![CDATA[<p dir="auto">Well, I know it must be defined in this part of the code below, I just don't know how. Would you be so kind to writte few lines for Button, for example?</p>
<pre><code>class Ui_SCADA(object):
    def open_Login_Window(self):    
        self.window = QtWidgets.QDialog()
        self.ui = Ui_Dialog()
        self.ui.setupUi(self.window)        
        self.window.show()
        
    def setupUi(self, SCADA):
        SCADA.setObjectName("SCADA")
        SCADA.resize(888, 665)
</code></pre>
]]></description><link>https://forum.qt.io/post/691822</link><guid isPermaLink="true">https://forum.qt.io/post/691822</guid><dc:creator><![CDATA[California]]></dc:creator><pubDate>Thu, 25 Nov 2021 20:19:16 GMT</pubDate></item><item><title><![CDATA[Reply to How to call QPushButton and QLineEdit from window 2 on Thu, 25 Nov 2021 20:05:57 GMT]]></title><description><![CDATA[<p dir="auto">There are lots of examples in the <a href="https://doc.qt.io/qtforpython/examples/example_widgets_painting_painter.html" target="_blank" rel="noopener noreferrer nofollow ugc">Qt for Python documentation like this one</a>.</p>
]]></description><link>https://forum.qt.io/post/691816</link><guid isPermaLink="true">https://forum.qt.io/post/691816</guid><dc:creator><![CDATA[SGaist]]></dc:creator><pubDate>Thu, 25 Nov 2021 20:05:57 GMT</pubDate></item><item><title><![CDATA[Reply to How to call QPushButton and QLineEdit from window 2 on Thu, 25 Nov 2021 19:59:34 GMT]]></title><description><![CDATA[<p dir="auto">Thanks for your respond. Can you be more specific, couse Iam not an expert with python. Some example would be very appreciatted.</p>
<p dir="auto">Regards</p>
]]></description><link>https://forum.qt.io/post/691815</link><guid isPermaLink="true">https://forum.qt.io/post/691815</guid><dc:creator><![CDATA[California]]></dc:creator><pubDate>Thu, 25 Nov 2021 19:59:34 GMT</pubDate></item><item><title><![CDATA[Reply to How to call QPushButton and QLineEdit from window 2 on Thu, 25 Nov 2021 19:41:01 GMT]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">The correct way to do this is to give your dialogs proper accessor method that will return the content of the line edits you have in there.</p>
<p dir="auto">The widgets in your dialog are an implementation detail for the main window and thus your dialog should have a simple api that returns the data.</p>
]]></description><link>https://forum.qt.io/post/691809</link><guid isPermaLink="true">https://forum.qt.io/post/691809</guid><dc:creator><![CDATA[SGaist]]></dc:creator><pubDate>Thu, 25 Nov 2021 19:41:01 GMT</pubDate></item></channel></rss>