質問編集履歴
1
コードの添付
test
CHANGED
File without changes
|
test
CHANGED
@@ -1,3 +1,127 @@
|
|
1
1
|
Spyder2でPyQt4を用いてGUI実装の勉強をしているんですが、一回実行するたびにカーネルの再起動を要求してきます。いちいちリスタートがめんどくさいのですが解決方法がわかりません。なので対策を教えていただきたいです。
|
2
2
|
|
3
3
|
![実際の画面](307c343a8e9e942a0ef496818574ac51.jpeg)
|
4
|
+
|
5
|
+
|
6
|
+
|
7
|
+
実際に書いたコードが原因かもしれないのでコードも載せておきます。
|
8
|
+
|
9
|
+
```python3
|
10
|
+
|
11
|
+
# -*- coding: utf-8 -*-
|
12
|
+
|
13
|
+
|
14
|
+
|
15
|
+
# Form implementation generated from reading ui file 'untitled.ui'
|
16
|
+
|
17
|
+
#
|
18
|
+
|
19
|
+
# Created by: PyQt4 UI code generator 4.11.4
|
20
|
+
|
21
|
+
#
|
22
|
+
|
23
|
+
# WARNING! All changes made in this file will be lost!
|
24
|
+
|
25
|
+
|
26
|
+
|
27
|
+
from PyQt4 import QtCore, QtGui
|
28
|
+
|
29
|
+
|
30
|
+
|
31
|
+
try:
|
32
|
+
|
33
|
+
_fromUtf8 = QtCore.QString.fromUtf8
|
34
|
+
|
35
|
+
except AttributeError:
|
36
|
+
|
37
|
+
def _fromUtf8(s):
|
38
|
+
|
39
|
+
return s
|
40
|
+
|
41
|
+
|
42
|
+
|
43
|
+
try:
|
44
|
+
|
45
|
+
_encoding = QtGui.QApplication.UnicodeUTF8
|
46
|
+
|
47
|
+
def _translate(context, text, disambig):
|
48
|
+
|
49
|
+
return QtGui.QApplication.translate(context, text, disambig, _encoding)
|
50
|
+
|
51
|
+
except AttributeError:
|
52
|
+
|
53
|
+
def _translate(context, text, disambig):
|
54
|
+
|
55
|
+
return QtGui.QApplication.translate(context, text, disambig)
|
56
|
+
|
57
|
+
|
58
|
+
|
59
|
+
class Ui_MainWindow(object):
|
60
|
+
|
61
|
+
def setupUi(self, MainWindow):
|
62
|
+
|
63
|
+
MainWindow.setObjectName(_fromUtf8("MainWindow"))
|
64
|
+
|
65
|
+
MainWindow.resize(800, 600)
|
66
|
+
|
67
|
+
self.centralwidget = QtGui.QWidget(MainWindow)
|
68
|
+
|
69
|
+
self.centralwidget.setObjectName(_fromUtf8("centralwidget"))
|
70
|
+
|
71
|
+
self.webView = QtWebKit.QWebView(self.centralwidget)
|
72
|
+
|
73
|
+
self.webView.setGeometry(QtCore.QRect(150, 60, 451, 341))
|
74
|
+
|
75
|
+
self.webView.setUrl(QtCore.QUrl(_fromUtf8("http://www.yahoo.co.jp")))
|
76
|
+
|
77
|
+
self.webView.setObjectName(_fromUtf8("webView"))
|
78
|
+
|
79
|
+
MainWindow.setCentralWidget(self.centralwidget)
|
80
|
+
|
81
|
+
self.menubar = QtGui.QMenuBar(MainWindow)
|
82
|
+
|
83
|
+
self.menubar.setGeometry(QtCore.QRect(0, 0, 800, 24))
|
84
|
+
|
85
|
+
self.menubar.setObjectName(_fromUtf8("menubar"))
|
86
|
+
|
87
|
+
MainWindow.setMenuBar(self.menubar)
|
88
|
+
|
89
|
+
self.statusbar = QtGui.QStatusBar(MainWindow)
|
90
|
+
|
91
|
+
self.statusbar.setObjectName(_fromUtf8("statusbar"))
|
92
|
+
|
93
|
+
MainWindow.setStatusBar(self.statusbar)
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
self.retranslateUi(MainWindow)
|
98
|
+
|
99
|
+
QtCore.QMetaObject.connectSlotsByName(MainWindow)
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
def retranslateUi(self, MainWindow):
|
104
|
+
|
105
|
+
MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow", None))
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
from PyQt4 import QtWebKit
|
110
|
+
|
111
|
+
|
112
|
+
|
113
|
+
if __name__ == "__main__":
|
114
|
+
|
115
|
+
import sys
|
116
|
+
|
117
|
+
app = QtGui.QApplication(sys.argv)
|
118
|
+
|
119
|
+
MainWindow = QtGui.QMainWindow()
|
120
|
+
|
121
|
+
ui = Ui_MainWindow()
|
122
|
+
|
123
|
+
ui.setupUi(MainWindow)
|
124
|
+
|
125
|
+
MainWindow.show()
|
126
|
+
|
127
|
+
```
|