Tag: python

Pacharapol Withayasakpunt Pacharapol Withayasakpunt
Mon, February 26, 2018
Sharing Python project that works in another computer!

I find that the issue may includes:-

  • Module dependencies
    • This can be solved by using virtualenv since the very beginning of the project
  • Different python version
    • This can be managed very beautifully with tox
  • Requiring something else outside the first two. For example, brew install phantomjs
    • I don't yet know how to manage this one…
    • Perhaps Docker
Pacharapol Withayasakpunt Pacharapol Withayasakpunt
Tue, February 13, 2018
[Python-web.py] Turning website into a desktop app

This is what I have got:

from ui.mainWindow import MainWindow
from webview.controller import initServer

from PyQt5.QtWidgets import *
import sys
import httplib2
from time import sleep

if _<i>name_</i> == '__main__':
    initServer().start()

    h = httplib2.Http()
    while True:
        try:
            resp = h.request("http://0.0.0.0:8080/", 'HEAD')
            break
        except ConnectionRefusedError:
            sleep(1)
            continue

    app = QApplication(sys.argv)
    window = MainWindow()
    window.showUI()
    window.setBaseSize(1000, 600)
    window.move(QDesktopWidget().rect().center().x()-window.rect().center().x(), window.rect().y())
    sys.exit(app.exec_())