Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from PyQt5.QtCore import QUrl, Qt
- from PyQt5.QtGui import QFont
- from PyQt5.QtWidgets import QApplication, QWidget, QPushButton, QLabel, QVBoxLayout, QHBoxLayout, QLineEdit, QAction
- from PyQt5.QtWebEngineWidgets import *
- # Создаем приложение и окно
- app = QApplication([])
- window1 = QWidget()
- window1.setWindowTitle("Супер Поиск 3000")
- window2 = QWidget()
- window2.setWindowTitle("Поиск")
- # Окно 2
- browser = QWebEngineView()
- def click_me():
- window1.close()
- t = e1.text().replace(" ", "%20")
- browser.setUrl(QUrl("http://www.google.com/search?q="+t))
- window2.show()
- # Окно 1
- e1 = QLineEdit()
- e1.setAlignment(Qt.AlignCenter)
- l1 = QLabel('Вы можете найти здесь все что угодно!')
- l1.setFont(QFont("Arial", 30))
- b1 = QPushButton("Мне повезет!")
- b1.clicked.connect(click_me)
- HLayout = QHBoxLayout()
- HLayout.addStretch(1)
- HLayout.addWidget(l1)
- HLayout.addStretch(1)
- HLayoutButton = QHBoxLayout()
- HLayoutButton.addStretch(1)
- HLayoutButton.addWidget(b1)
- HLayoutButton.addStretch(1)
- HLayoutEdit = QHBoxLayout()
- HLayoutEdit.addStretch(0.1)
- HLayoutEdit.addWidget(e1)
- HLayoutEdit.addStretch(0.1)
- layout = QVBoxLayout()
- layout.addStretch(2)
- layout.addLayout(HLayout)
- layout.addLayout(HLayoutEdit)
- layout.addStretch(0.5)
- layout.addLayout(HLayoutButton)
- layout.addStretch(2)
- window1.setLayout(layout)
- layout3 = QHBoxLayout()
- layout3.addWidget(browser)
- window2.setLayout(layout3)
- # Доп параметры для окна
- window1.setGeometry(600, 200, 640, 480)
- window1.show()
- # Доп параметры для окна 2
- window2.setGeometry(400, 200, 1280, 720)
- # window2.show()
- # Запуск программы
- app.exec_()
Add Comment
Please, Sign In to add comment