├── .gitignore ├── NotWorking.png ├── README.md ├── Working.png ├── index.py ├── main.ui └── network.gif /.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | 6 | # C extensions 7 | *.so 8 | 9 | # Distribution / packaging 10 | .Python 11 | build/ 12 | develop-eggs/ 13 | dist/ 14 | downloads/ 15 | eggs/ 16 | .eggs/ 17 | lib/ 18 | lib64/ 19 | parts/ 20 | sdist/ 21 | var/ 22 | wheels/ 23 | *.egg-info/ 24 | .installed.cfg 25 | *.egg 26 | MANIFEST 27 | 28 | # PyInstaller 29 | # Usually these files are written by a python script from a template 30 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 31 | *.manifest 32 | *.spec 33 | 34 | # Installer logs 35 | pip-log.txt 36 | pip-delete-this-directory.txt 37 | 38 | # Unit test / coverage reports 39 | htmlcov/ 40 | .tox/ 41 | .coverage 42 | .coverage.* 43 | .cache 44 | nosetests.xml 45 | coverage.xml 46 | *.cover 47 | .hypothesis/ 48 | .pytest_cache/ 49 | 50 | # Translations 51 | *.mo 52 | *.pot 53 | 54 | # Django stuff: 55 | *.log 56 | local_settings.py 57 | db.sqlite3 58 | 59 | # Flask stuff: 60 | instance/ 61 | .webassets-cache 62 | 63 | # Scrapy stuff: 64 | .scrapy 65 | 66 | # Sphinx documentation 67 | docs/_build/ 68 | 69 | # PyBuilder 70 | target/ 71 | 72 | # Jupyter Notebook 73 | .ipynb_checkpoints 74 | 75 | # pyenv 76 | .python-version 77 | 78 | # celery beat schedule file 79 | celerybeat-schedule 80 | 81 | # SageMath parsed files 82 | *.sage.py 83 | 84 | # Environments 85 | .env 86 | .venv 87 | env/ 88 | venv/ 89 | ENV/ 90 | env.bak/ 91 | venv.bak/ 92 | 93 | # Spyder project settings 94 | .spyderproject 95 | .spyproject 96 | 97 | # Rope project settings 98 | .ropeproject 99 | 100 | # mkdocs documentation 101 | /site 102 | 103 | # mypy 104 | .mypy_cache/ 105 | -------------------------------------------------------------------------------- /NotWorking.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pythondeveloper6/PyQt5-Wifi-Hotspot-Simple-App/180f386f9c5fc81aea969702b6d2dd8c758a161c/NotWorking.png -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # PyQt5-Wifi-Hotspot-Simple-App 2 | 3 | 4 | 5 | ### screenshot of the app 6 | ![](NotWorking.png) 7 | 8 | ### screenshot of the app working ^_^ 9 | ![](Working.png) 10 | -------------------------------------------------------------------------------- /Working.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pythondeveloper6/PyQt5-Wifi-Hotspot-Simple-App/180f386f9c5fc81aea969702b6d2dd8c758a161c/Working.png -------------------------------------------------------------------------------- /index.py: -------------------------------------------------------------------------------- 1 | __author__ = 'Mahmoud Ahmed' 2 | from PyQt5.QtCore import * 3 | from PyQt5.QtGui import * 4 | from PyQt5.QtWidgets import * 5 | from PyQt5.uic import loadUiType 6 | import sys 7 | from os import path 8 | import os , time 9 | from os import * 10 | 11 | 12 | FORM_CLASS,_=loadUiType(path.join(path.dirname(__file__),"main.ui")) 13 | 14 | 15 | class main(QMainWindow,FORM_CLASS): 16 | def __init__(self,parent=None): 17 | super(main,self).__init__(parent) 18 | QMainWindow.__init__(self) 19 | self.setupUi(self) 20 | self.run_flash() 21 | self.button() 22 | self.run_flash() 23 | 24 | 25 | def run_flash(self): 26 | ##flash 27 | self.movie_screen = QLabel() 28 | self.movie_screen.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) 29 | self.movie_screen.setAlignment(Qt.AlignCenter) 30 | self.verticalLayout.addWidget(self.movie_screen) 31 | self.setLayout(self.verticalLayout) 32 | self.movie = QMovie("network.gif", QByteArray(), self) 33 | self.movie.setCacheMode(QMovie.CacheAll) 34 | self.movie.setSpeed(100) 35 | self.movie_screen.setMovie(self.movie) 36 | 37 | 38 | def button(self): 39 | # self.connect(self.pushButton, SIGNAL("clicked()"), self.create_button_clicked) 40 | self.pushButton.clicked.connect(self.create_button_clicked) 41 | 42 | def create_button_clicked(self): 43 | if self.pushButton.text() == 'Create Hotspot': 44 | self.start() 45 | self.create_wifi() 46 | 47 | elif self.pushButton.text() == 'Stop Hotspot': 48 | self.stop() 49 | 50 | 51 | def start(self): 52 | self.movie.start() 53 | self.pushButton.setText('Stop Hotspot') 54 | 55 | def stop(self): 56 | self.movie.stop() 57 | self.pushButton.setText('Create Hotspot') 58 | os.popen("netsh wlan stop hostednetwork") 59 | 60 | 61 | 62 | def create_wifi(self): 63 | os.system("cls") 64 | wifi_name = self.lineEdit.text() 65 | string = self.lineEdit_2.text() 66 | if string=="": 67 | string="Hotspot" 68 | if len(string)<8: 69 | print (" String must be longer than 8 chars") 70 | os.popen("netsh wlan set hostednetwork mode=allow ssid={} key={}".format(wifi_name,string)) 71 | os.popen("netsh wlan start hostednetwork") 72 | print('Done') 73 | 74 | def minimize(self): 75 | self.setWindowFlags(self.windowFlags()|Qt.WindowMinimizeButtonHint | 76 | Qt.WindowSystemMenuHint) 77 | 78 | 79 | def main_app(): 80 | app = QApplication(sys.argv) 81 | window = main() 82 | window.show() 83 | app.exec_() 84 | 85 | if __name__ == "__main__": 86 | main_app() 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | -------------------------------------------------------------------------------- /main.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | MainWindow 4 | 5 | 6 | 7 | 0 8 | 0 9 | 307 10 | 445 11 | 12 | 13 | 14 | MainWindow 15 | 16 | 17 | Qt::LeftToRight 18 | 19 | 20 | QToolTip 21 | { 22 | border: 1px solid black; 23 | background-color: #ffa02f; 24 | padding: 1px; 25 | border-radius: 3px; 26 | opacity: 100; 27 | } 28 | 29 | QWidget 30 | { 31 | color: #b1b1b1; 32 | background-color: #323232; 33 | } 34 | 35 | QWidget:item:hover 36 | { 37 | background-color: QLinearGradient( x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #ffa02f, stop: 1 #ca0619); 38 | color: #000000; 39 | } 40 | 41 | QWidget:item:selected 42 | { 43 | background-color: QLinearGradient( x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #ffa02f, stop: 1 #d7801a); 44 | } 45 | 46 | QMenuBar::item 47 | { 48 | background: transparent; 49 | } 50 | 51 | QMenuBar::item:selected 52 | { 53 | background: transparent; 54 | border: 1px solid #ffaa00; 55 | } 56 | 57 | QMenuBar::item:pressed 58 | { 59 | background: #444; 60 | border: 1px solid #000; 61 | background-color: QLinearGradient( 62 | x1:0, y1:0, 63 | x2:0, y2:1, 64 | stop:1 #212121, 65 | stop:0.4 #343434/*, 66 | stop:0.2 #343434, 67 | stop:0.1 #ffaa00*/ 68 | ); 69 | margin-bottom:-1px; 70 | padding-bottom:1px; 71 | } 72 | 73 | QMenu 74 | { 75 | border: 1px solid #000; 76 | } 77 | 78 | QMenu::item 79 | { 80 | padding: 2px 20px 2px 20px; 81 | } 82 | 83 | QMenu::item:selected 84 | { 85 | color: #000000; 86 | } 87 | 88 | QWidget:disabled 89 | { 90 | color: #404040; 91 | background-color: #323232; 92 | } 93 | 94 | QAbstractItemView 95 | { 96 | background-color: QLinearGradient( x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #4d4d4d, stop: 0.1 #646464, stop: 1 #5d5d5d); 97 | } 98 | 99 | QWidget:focus 100 | { 101 | /*border: 2px solid QLinearGradient( x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #ffa02f, stop: 1 #d7801a);*/ 102 | } 103 | 104 | QLineEdit 105 | { 106 | background-color: QLinearGradient( x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #4d4d4d, stop: 0 #646464, stop: 1 #5d5d5d); 107 | padding: 1px; 108 | border-style: solid; 109 | border: 1px solid #1e1e1e; 110 | border-radius: 5; 111 | } 112 | 113 | QPushButton 114 | { 115 | color: #b1b1b1; 116 | background-color: QLinearGradient( x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #565656, stop: 0.1 #525252, stop: 0.5 #4e4e4e, stop: 0.9 #4a4a4a, stop: 1 #464646); 117 | border-width: 1px; 118 | border-color: #1e1e1e; 119 | border-style: solid; 120 | border-radius: 6; 121 | padding: 3px; 122 | font-size: 12px; 123 | padding-left: 5px; 124 | padding-right: 5px; 125 | } 126 | 127 | QPushButton:pressed 128 | { 129 | background-color: QLinearGradient( x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #2d2d2d, stop: 0.1 #2b2b2b, stop: 0.5 #292929, stop: 0.9 #282828, stop: 1 #252525); 130 | } 131 | 132 | QComboBox 133 | { 134 | selection-background-color: #ffaa00; 135 | background-color: QLinearGradient( x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #565656, stop: 0.1 #525252, stop: 0.5 #4e4e4e, stop: 0.9 #4a4a4a, stop: 1 #464646); 136 | border-style: solid; 137 | border: 1px solid #1e1e1e; 138 | border-radius: 5; 139 | } 140 | 141 | QComboBox:hover,QPushButton:hover 142 | { 143 | border: 2px solid QLinearGradient( x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #ffa02f, stop: 1 #d7801a); 144 | } 145 | 146 | 147 | QComboBox:on 148 | { 149 | padding-top: 3px; 150 | padding-left: 4px; 151 | background-color: QLinearGradient( x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #2d2d2d, stop: 0.1 #2b2b2b, stop: 0.5 #292929, stop: 0.9 #282828, stop: 1 #252525); 152 | selection-background-color: #ffaa00; 153 | } 154 | 155 | QComboBox QAbstractItemView 156 | { 157 | border: 2px solid darkgray; 158 | selection-background-color: QLinearGradient( x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #ffa02f, stop: 1 #d7801a); 159 | } 160 | 161 | QComboBox::drop-down 162 | { 163 | subcontrol-origin: padding; 164 | subcontrol-position: top right; 165 | width: 15px; 166 | 167 | border-left-width: 0px; 168 | border-left-color: darkgray; 169 | border-left-style: solid; /* just a single line */ 170 | border-top-right-radius: 3px; /* same radius as the QComboBox */ 171 | border-bottom-right-radius: 3px; 172 | } 173 | 174 | QComboBox::down-arrow 175 | { 176 | image: url(:/down_arrow.png); 177 | } 178 | 179 | QGroupBox:focus 180 | { 181 | border: 2px solid QLinearGradient( x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #ffa02f, stop: 1 #d7801a); 182 | } 183 | 184 | QTextEdit:focus 185 | { 186 | border: 2px solid QLinearGradient( x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #ffa02f, stop: 1 #d7801a); 187 | } 188 | 189 | QScrollBar:horizontal { 190 | border: 1px solid #222222; 191 | background: QLinearGradient( x1: 0, y1: 0, x2: 0, y2: 1, stop: 0.0 #121212, stop: 0.2 #282828, stop: 1 #484848); 192 | height: 7px; 193 | margin: 0px 16px 0 16px; 194 | } 195 | 196 | QScrollBar::handle:horizontal 197 | { 198 | background: QLinearGradient( x1: 0, y1: 0, x2: 1, y2: 0, stop: 0 #ffa02f, stop: 0.5 #d7801a, stop: 1 #ffa02f); 199 | min-height: 20px; 200 | border-radius: 2px; 201 | } 202 | 203 | QScrollBar::add-line:horizontal { 204 | border: 1px solid #1b1b19; 205 | border-radius: 2px; 206 | background: QLinearGradient( x1: 0, y1: 0, x2: 1, y2: 0, stop: 0 #ffa02f, stop: 1 #d7801a); 207 | width: 14px; 208 | subcontrol-position: right; 209 | subcontrol-origin: margin; 210 | } 211 | 212 | QScrollBar::sub-line:horizontal { 213 | border: 1px solid #1b1b19; 214 | border-radius: 2px; 215 | background: QLinearGradient( x1: 0, y1: 0, x2: 1, y2: 0, stop: 0 #ffa02f, stop: 1 #d7801a); 216 | width: 14px; 217 | subcontrol-position: left; 218 | subcontrol-origin: margin; 219 | } 220 | 221 | QScrollBar::right-arrow:horizontal, QScrollBar::left-arrow:horizontal 222 | { 223 | border: 1px solid black; 224 | width: 1px; 225 | height: 1px; 226 | background: white; 227 | } 228 | 229 | QScrollBar::add-page:horizontal, QScrollBar::sub-page:horizontal 230 | { 231 | background: none; 232 | } 233 | 234 | QScrollBar:vertical 235 | { 236 | background: QLinearGradient( x1: 0, y1: 0, x2: 1, y2: 0, stop: 0.0 #121212, stop: 0.2 #282828, stop: 1 #484848); 237 | width: 7px; 238 | margin: 16px 0 16px 0; 239 | border: 1px solid #222222; 240 | } 241 | 242 | QScrollBar::handle:vertical 243 | { 244 | background: QLinearGradient( x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #ffa02f, stop: 0.5 #d7801a, stop: 1 #ffa02f); 245 | min-height: 20px; 246 | border-radius: 2px; 247 | } 248 | 249 | QScrollBar::add-line:vertical 250 | { 251 | border: 1px solid #1b1b19; 252 | border-radius: 2px; 253 | background: QLinearGradient( x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #ffa02f, stop: 1 #d7801a); 254 | height: 14px; 255 | subcontrol-position: bottom; 256 | subcontrol-origin: margin; 257 | } 258 | 259 | QScrollBar::sub-line:vertical 260 | { 261 | border: 1px solid #1b1b19; 262 | border-radius: 2px; 263 | background: QLinearGradient( x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #d7801a, stop: 1 #ffa02f); 264 | height: 14px; 265 | subcontrol-position: top; 266 | subcontrol-origin: margin; 267 | } 268 | 269 | QScrollBar::up-arrow:vertical, QScrollBar::down-arrow:vertical 270 | { 271 | border: 1px solid black; 272 | width: 1px; 273 | height: 1px; 274 | background: white; 275 | } 276 | 277 | 278 | QScrollBar::add-page:vertical, QScrollBar::sub-page:vertical 279 | { 280 | background: none; 281 | } 282 | 283 | QTextEdit 284 | { 285 | background-color: #242424; 286 | } 287 | 288 | QPlainTextEdit 289 | { 290 | background-color: #242424; 291 | } 292 | 293 | QHeaderView::section 294 | { 295 | background-color: QLinearGradient(x1:0, y1:0, x2:0, y2:1, stop:0 #616161, stop: 0.5 #505050, stop: 0.6 #434343, stop:1 #656565); 296 | color: white; 297 | padding-left: 4px; 298 | border: 1px solid #6c6c6c; 299 | } 300 | 301 | QCheckBox:disabled 302 | { 303 | color: #414141; 304 | } 305 | 306 | QDockWidget::title 307 | { 308 | text-align: center; 309 | spacing: 3px; /* spacing between items in the tool bar */ 310 | background-color: QLinearGradient(x1:0, y1:0, x2:0, y2:1, stop:0 #323232, stop: 0.5 #242424, stop:1 #323232); 311 | } 312 | 313 | QDockWidget::close-button, QDockWidget::float-button 314 | { 315 | text-align: center; 316 | spacing: 1px; /* spacing between items in the tool bar */ 317 | background-color: QLinearGradient(x1:0, y1:0, x2:0, y2:1, stop:0 #323232, stop: 0.5 #242424, stop:1 #323232); 318 | } 319 | 320 | QDockWidget::close-button:hover, QDockWidget::float-button:hover 321 | { 322 | background: #242424; 323 | } 324 | 325 | QDockWidget::close-button:pressed, QDockWidget::float-button:pressed 326 | { 327 | padding: 1px -1px -1px 1px; 328 | } 329 | 330 | QMainWindow::separator 331 | { 332 | background-color: QLinearGradient(x1:0, y1:0, x2:0, y2:1, stop:0 #161616, stop: 0.5 #151515, stop: 0.6 #212121, stop:1 #343434); 333 | color: white; 334 | padding-left: 4px; 335 | border: 1px solid #4c4c4c; 336 | spacing: 3px; /* spacing between items in the tool bar */ 337 | } 338 | 339 | QMainWindow::separator:hover 340 | { 341 | 342 | background-color: QLinearGradient(x1:0, y1:0, x2:0, y2:1, stop:0 #d7801a, stop:0.5 #b56c17 stop:1 #ffa02f); 343 | color: white; 344 | padding-left: 4px; 345 | border: 1px solid #6c6c6c; 346 | spacing: 3px; /* spacing between items in the tool bar */ 347 | } 348 | 349 | QToolBar::handle 350 | { 351 | spacing: 3px; /* spacing between items in the tool bar */ 352 | background: url(:/images/handle.png); 353 | } 354 | 355 | QMenu::separator 356 | { 357 | height: 2px; 358 | background-color: QLinearGradient(x1:0, y1:0, x2:0, y2:1, stop:0 #161616, stop: 0.5 #151515, stop: 0.6 #212121, stop:1 #343434); 359 | color: white; 360 | padding-left: 4px; 361 | margin-left: 10px; 362 | margin-right: 5px; 363 | } 364 | 365 | QProgressBar 366 | { 367 | border: 2px solid grey; 368 | border-radius: 5px; 369 | text-align: center; 370 | } 371 | 372 | QProgressBar::chunk 373 | { 374 | background-color: #d7801a; 375 | width: 2.15px; 376 | margin: 0.5px; 377 | } 378 | 379 | QTabBar::tab { 380 | color: #b1b1b1; 381 | border: 1px solid #444; 382 | border-bottom-style: none; 383 | background-color: #323232; 384 | padding-left: 10px; 385 | padding-right: 10px; 386 | padding-top: 3px; 387 | padding-bottom: 2px; 388 | margin-right: -1px; 389 | } 390 | 391 | QTabWidget::pane { 392 | border: 1px solid #444; 393 | top: 1px; 394 | } 395 | 396 | QTabBar::tab:last 397 | { 398 | margin-right: 0; /* the last selected tab has nothing to overlap with on the right */ 399 | border-top-right-radius: 3px; 400 | } 401 | 402 | QTabBar::tab:first:!selected 403 | { 404 | margin-left: 0px; /* the last selected tab has nothing to overlap with on the right */ 405 | 406 | 407 | border-top-left-radius: 3px; 408 | } 409 | 410 | QTabBar::tab:!selected 411 | { 412 | color: #b1b1b1; 413 | border-bottom-style: solid; 414 | margin-top: 3px; 415 | background-color: QLinearGradient(x1:0, y1:0, x2:0, y2:1, stop:1 #212121, stop:.4 #343434); 416 | } 417 | 418 | QTabBar::tab:selected 419 | { 420 | border-top-left-radius: 3px; 421 | border-top-right-radius: 3px; 422 | margin-bottom: 0px; 423 | } 424 | 425 | QTabBar::tab:!selected:hover 426 | { 427 | /*border-top: 2px solid #ffaa00; 428 | padding-bottom: 3px;*/ 429 | border-top-left-radius: 3px; 430 | border-top-right-radius: 3px; 431 | background-color: QLinearGradient(x1:0, y1:0, x2:0, y2:1, stop:1 #212121, stop:0.4 #343434, stop:0.2 #343434, stop:0.1 #ffaa00); 432 | } 433 | 434 | QRadioButton::indicator:checked, QRadioButton::indicator:unchecked{ 435 | color: #b1b1b1; 436 | background-color: #323232; 437 | border: 1px solid #b1b1b1; 438 | border-radius: 6px; 439 | } 440 | 441 | QRadioButton::indicator:checked 442 | { 443 | background-color: qradialgradient( 444 | cx: 0.5, cy: 0.5, 445 | fx: 0.5, fy: 0.5, 446 | radius: 1.0, 447 | stop: 0.25 #ffaa00, 448 | stop: 0.3 #323232 449 | ); 450 | } 451 | 452 | QCheckBox::indicator{ 453 | color: #b1b1b1; 454 | background-color: #323232; 455 | border: 1px solid #b1b1b1; 456 | width: 9px; 457 | height: 9px; 458 | } 459 | 460 | QRadioButton::indicator 461 | { 462 | border-radius: 6px; 463 | } 464 | 465 | QRadioButton::indicator:hover, QCheckBox::indicator:hover 466 | { 467 | border: 1px solid #ffaa00; 468 | } 469 | 470 | QCheckBox::indicator:checked 471 | { 472 | image:url(:/images/checkbox.png); 473 | } 474 | 475 | QCheckBox::indicator:disabled, QRadioButton::indicator:disabled 476 | { 477 | border: 1px solid #444; 478 | } 479 | 480 | 481 | 482 | 483 | 484 | 90 485 | 380 486 | 131 487 | 31 488 | 489 | 490 | 491 | Create Hotspot 492 | 493 | 494 | 495 | 496 | 497 | 140 498 | 30 499 | 151 500 | 31 501 | 502 | 503 | 504 | 505 | 506 | 507 | 140 508 | 90 509 | 151 510 | 31 511 | 512 | 513 | 514 | 515 | 516 | 517 | 30 518 | 40 519 | 101 520 | 20 521 | 522 | 523 | 524 | 525 | 11 526 | 527 | 528 | 529 | Hotspot Name 530 | 531 | 532 | 533 | 534 | 535 | 20 536 | 90 537 | 121 538 | 20 539 | 540 | 541 | 542 | 543 | 11 544 | 545 | 546 | 547 | Hotspot Password 548 | 549 | 550 | 551 | 552 | 553 | 10 554 | 140 555 | 291 556 | 231 557 | 558 | 559 | 560 | 561 | 562 | 563 | 564 | 565 | 0 566 | 0 567 | 307 568 | 22 569 | 570 | 571 | 572 | 573 | 574 | 575 | 576 | 577 | -------------------------------------------------------------------------------- /network.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pythondeveloper6/PyQt5-Wifi-Hotspot-Simple-App/180f386f9c5fc81aea969702b6d2dd8c758a161c/network.gif --------------------------------------------------------------------------------