可能性の重複:私はQWebViewを開きますが、アプリのウィンドウ、Windowsのコンソールウィンドウに加えてに開放されたシンプルなアプリを作った
How can I hide the console window in a PyQt app running on Windows?私のアプリのコンソールウィンドウを隠すにはどうすればいいですか?
。
この理由は何ですか?代わりにpython.exeの
import sys
import socket
from PyQt4 import QtCore, QtGui
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from PyQt4.QtWebKit import QWebView
class AppWindow(QtGui.QWidget):
def __init__(self, parent=None):
QtGui.QWidget.__init__(self, parent)
self.setGeometry(300, 300, 200, 25)
self.setWindowTitle('TrayIP')
self.create_sys_tray()
self.hostname = socket.gethostname()
self.ip = socket.gethostbyname(self.hostname)
self.label = QLabel("IP: " + self.ip, self)
self.label.setFont(QtGui.QFont('Helvetica', 14))
self.timer = QTimer()
self.connect(self.timer, QtCore.SIGNAL('timeout()'), self.timerupdate)
self.timer.start(10000)
def timerupdate(self):
self.web = QWebView()
self.web.load(QUrl('http://xxx'))
def create_sys_tray(self):
self.sysTray = QtGui.QSystemTrayIcon(self)
self.sysTray.setIcon(QtGui.QIcon('ico.ico'))
self.sysTray.setVisible(True)
self.connect(self.sysTray, QtCore.SIGNAL("activated(QSystemTrayIcon::ActivationReason)"), self.on_sys_tray_activated)
self.sysTrayMenu = QtGui.QMenu(self)
act = self.sysTrayMenu.addAction("FOO")
def on_sys_tray_activated(self, reason):
if self.isVisible():
self.setVisible(False)
else:
self.setVisible(True)
app = QtGui.QApplication(sys.argv)
window = AppWindow()
window.show()
sys.exit(app.exec_())
クールを変更する必要があります、それは動作します:Dのおかげで! – Jason94