Skip to content

Instantly share code, notes, and snippets.

@devalexandre
Created June 29, 2018 16:49
Show Gist options
  • Save devalexandre/3d560886399971cabd2c6bf4052dd462 to your computer and use it in GitHub Desktop.
Save devalexandre/3d560886399971cabd2c6bf4052dd462 to your computer and use it in GitHub Desktop.
from PySide2 import *
from PySide2.QtWidgets import *
from PySide2.QtCore import *
import sys
class MainWindow(QMainWindow):
def __init__(self, *args, **kwargs):
super(MainWindow,self).__init__(*args,**kwargs)
self.setWindowTitle("My Window")
layout = QFormLayout()
txtName = QLineEdit()
btnRun = QPushButton('&Run',self)
btnRun.clicked.connect(self.onClick)
layout.addRow(self.tr("&Name:"),txtName)
layout.addRow(btnRun)
widget = QWidget()
widget.setLayout(layout)
self.setCentralWidget(widget)
def onClick(self):
print('como pegar o texto do campo nome?')
app = QApplication(sys.argv)
window = MainWindow()
window.show()
app.exec_()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment