質問編集履歴
5
余計な文字削除
test
CHANGED
File without changes
|
test
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
### 前提・実現したいこと
|
2
2
|
|
3
|
-
|
3
|
+
|
4
4
|
|
5
5
|
下のようなWidgetの配置で,緯距(X)以降を下の段に配置したいです.
|
6
6
|
|
7
|
-
ヒントでいいので,ご教示ください.
|
7
|
+
ヒントでいいので,ご教示ください.
|
8
8
|
|
9
9
|
![イメージ説明](707eb4517db4bd2eecac66bf1fa0440d.png)
|
10
10
|
|
4
画像の変更
test
CHANGED
File without changes
|
test
CHANGED
@@ -4,9 +4,9 @@
|
|
4
4
|
|
5
5
|
下のようなWidgetの配置で,緯距(X)以降を下の段に配置したいです.
|
6
6
|
|
7
|
-
ヒントでいいので,ご教示ください.
|
7
|
+
ヒントでいいので,ご教示ください.]
|
8
8
|
|
9
|
-
![
|
9
|
+
![イメージ説明](707eb4517db4bd2eecac66bf1fa0440d.png)
|
10
10
|
|
11
11
|
|
12
12
|
|
@@ -120,7 +120,7 @@
|
|
120
120
|
|
121
121
|
self.setLayout(mainLayout)
|
122
122
|
|
123
|
-
self.setWindowTitle("
|
123
|
+
self.setWindowTitle("緯距・経距計算")
|
124
124
|
|
125
125
|
|
126
126
|
|
3
画像が貼られてなかったです.
test
CHANGED
File without changes
|
test
CHANGED
@@ -5,6 +5,10 @@
|
|
5
5
|
下のようなWidgetの配置で,緯距(X)以降を下の段に配置したいです.
|
6
6
|
|
7
7
|
ヒントでいいので,ご教示ください.![Widgetの配置状況](7ad0a96c571d2bbb13d11e3c8d5691f3.png)]
|
8
|
+
|
9
|
+
![Widgetの配置](e9afbe6bf720530a1e9b3c28c35e4154.png)
|
10
|
+
|
11
|
+
|
8
12
|
|
9
13
|
### 該当のソースコード
|
10
14
|
|
2
画像が貼られてなかったです
test
CHANGED
File without changes
|
test
CHANGED
@@ -4,9 +4,7 @@
|
|
4
4
|
|
5
5
|
下のようなWidgetの配置で,緯距(X)以降を下の段に配置したいです.
|
6
6
|
|
7
|
-
ヒントでいいので,ご教示ください.](a9
|
7
|
+
ヒントでいいので,ご教示ください.![Widgetの配置状況](7ad0a96c571d2bbb13d11e3c8d5691f3.png)]
|
8
|
-
|
9
|
-
|
10
8
|
|
11
9
|
### 該当のソースコード
|
12
10
|
|
1
不完全でした
test
CHANGED
File without changes
|
test
CHANGED
@@ -2,19 +2,9 @@
|
|
2
2
|
|
3
3
|
![
|
4
4
|
|
5
|
-
|
5
|
+
下のようなWidgetの配置で,緯距(X)以降を下の段に配置したいです.
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
|
7
|
+
ヒントでいいので,ご教示ください.](a994850ae847c909b7e3075574c518a2.png)
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
```
|
14
|
-
|
15
|
-
エラーメッセージ
|
16
|
-
|
17
|
-
```
|
18
8
|
|
19
9
|
|
20
10
|
|
@@ -22,24 +12,138 @@
|
|
22
12
|
|
23
13
|
|
24
14
|
|
25
|
-
```
|
15
|
+
```Python
|
26
16
|
|
27
|
-
|
17
|
+
#!/usr/bin/env python
|
28
|
-
|
29
|
-
```
|
30
18
|
|
31
19
|
|
32
20
|
|
21
|
+
from PyQt5.QtWidgets import (QApplication, QWidget,
|
22
|
+
|
23
|
+
QGridLayout, QVBoxLayout, QHBoxLayout,
|
24
|
+
|
33
|
-
|
25
|
+
QLabel, QLineEdit, QPushButton)
|
34
26
|
|
35
27
|
|
36
28
|
|
37
|
-
|
29
|
+
def factorial(n):
|
30
|
+
|
31
|
+
if n < 0:
|
32
|
+
|
33
|
+
return -1
|
34
|
+
|
35
|
+
elif n == 0:
|
36
|
+
|
37
|
+
return 1
|
38
|
+
|
39
|
+
else:
|
40
|
+
|
41
|
+
return n * factorial(n-1)#calcuation
|
38
42
|
|
39
43
|
|
40
44
|
|
45
|
+
class MainWindow(QWidget):
|
46
|
+
|
41
|
-
|
47
|
+
def __init__(self, parent=None):
|
48
|
+
|
49
|
+
super(MainWindow, self).__init__(parent)
|
42
50
|
|
43
51
|
|
44
52
|
|
53
|
+
self.inputDegree = QLineEdit()
|
54
|
+
|
55
|
+
self.inputMinute = QLineEdit()
|
56
|
+
|
57
|
+
self.inputSecond = QLineEdit()
|
58
|
+
|
59
|
+
self.outputLat = QLineEdit()
|
60
|
+
|
61
|
+
self.outputLat.setReadOnly(True)
|
62
|
+
|
63
|
+
self.outputLon = QLineEdit()
|
64
|
+
|
65
|
+
self.outputLon.setReadOnly(True)
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
self.calcButton = QPushButton("&Calc")
|
70
|
+
|
71
|
+
self.calcButton.clicked.connect(self.calc)
|
72
|
+
|
73
|
+
|
74
|
+
|
75
|
+
lineLayout_1 = QGridLayout()
|
76
|
+
|
77
|
+
lineLayout_1.addWidget(QLabel("azimuth"), 0, 0)
|
78
|
+
|
79
|
+
lineLayout_1.addWidget(self.inputDegree, 0, 1)
|
80
|
+
|
81
|
+
lineLayout_1.addWidget(QLabel("°"), 0, 2)
|
82
|
+
|
83
|
+
lineLayout_1.addWidget(self.inputMinute, 0, 3)
|
84
|
+
|
85
|
+
lineLayout_1.addWidget(QLabel("'"), 0, 4)
|
86
|
+
|
87
|
+
lineLayout_1.addWidget(self.inputSecond, 0, 5)
|
88
|
+
|
89
|
+
lineLayout_1.addWidget(QLabel("''"), 0, 6)
|
90
|
+
|
91
|
+
lineLayout_2 = QGridLayout()
|
92
|
+
|
93
|
+
lineLayout_2.addWidget(QLabel("緯距(X)"), 0, 0)
|
94
|
+
|
95
|
+
lineLayout_2.addWidget(self.outputLat, 0, 1)
|
96
|
+
|
97
|
+
lineLayout_2.addWidget(QLabel("経距(Y)"), 0, 2)
|
98
|
+
|
99
|
+
lineLayout_2.addWidget(self.outputLon, 0, 3)
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
buttonLayout = QVBoxLayout()
|
104
|
+
|
105
|
+
buttonLayout.addWidget(self.calcButton)
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
mainLayout = QHBoxLayout()
|
110
|
+
|
111
|
+
mainLayout.addLayout(lineLayout_1)
|
112
|
+
|
113
|
+
mainLayout.addLayout(lineLayout_2)
|
114
|
+
|
115
|
+
mainLayout.addLayout(buttonLayout)
|
116
|
+
|
117
|
+
|
118
|
+
|
119
|
+
self.setLayout(mainLayout)
|
120
|
+
|
121
|
+
self.setWindowTitle("Factorial")
|
122
|
+
|
123
|
+
|
124
|
+
|
125
|
+
def calc(self):
|
126
|
+
|
127
|
+
n = int(self.inputLine.text())##input
|
128
|
+
|
129
|
+
r = factorial(n)
|
130
|
+
|
131
|
+
self.outputLine.setText(str(r))
|
132
|
+
|
133
|
+
|
134
|
+
|
135
|
+
if __name__ == '__main__':
|
136
|
+
|
137
|
+
import sys
|
138
|
+
|
139
|
+
app = QApplication(sys.argv)
|
140
|
+
|
141
|
+
main_window = MainWindow()
|
142
|
+
|
143
|
+
|
144
|
+
|
145
|
+
main_window.show()
|
146
|
+
|
45
|
-
|
147
|
+
sys.exit(app.exec_())
|
148
|
+
|
149
|
+
```
|