質問編集履歴

7

画像追加

2020/05/16 11:03

投稿

saya24
saya24

スコア222

test CHANGED
File without changes
test CHANGED
@@ -279,3 +279,11 @@
279
279
  windowアプリケーションではない位置づけにすると、出力ウィンドウやコンソールにエラー内容が表示される(コードは反転してくれません)
280
280
 
281
281
  ![イメージ説明](d0224b9be00223a608dfa526dfafe39c.png)
282
+
283
+
284
+
285
+ ### 2020/05/16 20:05追加
286
+
287
+ VisualStudio上でプロジェクトをWindowsアプリケーションと位置付ける・位置付けない
288
+
289
+ ![これ](02812114452a18bbc69d94e46ef642d8.png)

6

画像追加

2020/05/16 11:03

投稿

saya24
saya24

スコア222

test CHANGED
File without changes
test CHANGED
@@ -273,3 +273,9 @@
273
273
 
274
274
 
275
275
  ```
276
+
277
+ ### 2020/05/15 23:12追加
278
+
279
+ windowアプリケーションではない位置づけにすると、出力ウィンドウやコンソールにエラー内容が表示される(コードは反転してくれません)
280
+
281
+ ![イメージ説明](d0224b9be00223a608dfa526dfafe39c.png)

5

コード追加

2020/05/15 14:12

投稿

saya24
saya24

スコア222

test CHANGED
File without changes
test CHANGED
@@ -182,9 +182,9 @@
182
182
 
183
183
 
184
184
 
185
- param = {"data1": 9, "data2": "hogehoge"}
185
+ param = {"data1": 9, "data2": "hoge"}
186
-
186
+
187
- r = requests.post("http://99.99.99.99/hogehoge/test01.php", data=param)
187
+ r = requests.post("http://99.99.99.99/hoge/test01.php", data=param)
188
188
 
189
189
  if (r.status_code == 200):
190
190
 

4

コード追加

2020/05/15 07:45

投稿

saya24
saya24

スコア222

test CHANGED
File without changes
test CHANGED
@@ -35,3 +35,241 @@
35
35
  ### 2020/05/14 21;54 追加
36
36
 
37
37
  ![イメージ説明](5603fdd16794692c1f8720554d31342b.png)
38
+
39
+
40
+
41
+ ### 2020/05/15 16:35 追加
42
+
43
+ たとえば ありえないURLへアクセスするrequest文を含むプログラムでも、動作の異常検知はapp.mainloop()の部分
44
+
45
+ ```Python
46
+
47
+ from tkinter import *
48
+
49
+ import tkinter.ttk as ttk
50
+
51
+ import tkinter.messagebox as tkMB
52
+
53
+ import tkinter.scrolledtext as tksc
54
+
55
+ import math
56
+
57
+ import requests
58
+
59
+
60
+
61
+
62
+
63
+
64
+
65
+ class Apprication(ttk.Frame):
66
+
67
+
68
+
69
+ def __init__(self, app):
70
+
71
+ super().__init__(app)
72
+
73
+ self.pack()
74
+
75
+
76
+
77
+ btn = ttk.Button(self, text="Sub", command=self.openDialog)
78
+
79
+ btn.grid(row=1, column=0)
80
+
81
+
82
+
83
+
84
+
85
+
86
+
87
+ # 子画面開く
88
+
89
+ def openDialog(self):
90
+
91
+
92
+
93
+ self.dialog = Toplevel(self)
94
+
95
+ self.dialog.title("Sub Menu")
96
+
97
+
98
+
99
+ #フォームサイズを実行端末から導き、ド真中に配置表示
100
+
101
+ lw = math.ceil(ww * 0.408)
102
+
103
+ lh = math.ceil(wh * 0.477)
104
+
105
+ self.dialog.geometry(str(lw)+"x"+str(lh)+"+"+str(int(ww/2-lw/2))+"+"+str(int(wh/2-lh/2)) )
106
+
107
+
108
+
109
+ self.dialog.configure(bg="#F0FFFF")
110
+
111
+ self.dialog.resizable(0,0)
112
+
113
+ self.dialog.protocol('WM_DELETE_WINDOW', (lambda: 'pass')())
114
+
115
+
116
+
117
+ # 当該ダイアログのカーソルを変更し、関数側でもカーソルを変更できるように
118
+
119
+ self.dialog['cursor'] = 'hand2'
120
+
121
+ self.this = self.dialog
122
+
123
+
124
+
125
+ # modalに
126
+
127
+ self.dialog.grab_set()
128
+
129
+
130
+
131
+
132
+
133
+
134
+
135
+ # ★WebAPIアクセスボタン★
136
+
137
+ btn1 = Button(self.dialog, text='Execute', width=10, command=self.webAPI)
138
+
139
+ btn1.grid(row=2, columnspan=11, pady=(0, 20))
140
+
141
+
142
+
143
+ # 閉じるボタン
144
+
145
+ btn3 = Button(self.dialog, text='Quit', command=self.closeDialog, width=10)
146
+
147
+ btn3.grid(row=5, column=10, pady=10, padx=(0,10))
148
+
149
+
150
+
151
+
152
+
153
+ self.dialog.grid_rowconfigure(1, weight=1)
154
+
155
+ self.dialog.grid_rowconfigure(3, weight=1)
156
+
157
+ self.dialog.grid_columnconfigure(2, weight=1)
158
+
159
+
160
+
161
+
162
+
163
+
164
+
165
+
166
+
167
+ # 子画面閉じる
168
+
169
+ def closeDialog(self):
170
+
171
+ self.dialog.destroy()
172
+
173
+
174
+
175
+ # WebAPIアクセス
176
+
177
+ def webAPI(self):
178
+
179
+ self.this['cursor'] = 'watch'
180
+
181
+ self.update() #画面更新
182
+
183
+
184
+
185
+ param = {"data1": 9, "data2": "hogehoge"}
186
+
187
+ r = requests.post("http://99.99.99.99/hogehoge/test01.php", data=param)
188
+
189
+ if (r.status_code == 200):
190
+
191
+ tkMB.showinfo("Result","Finished !", parent=self.this)
192
+
193
+ else:
194
+
195
+ tkMB.showwarning("Result", "[" + str(r.status_code) + "] error occured !", parent=self.this)
196
+
197
+
198
+
199
+ self.this['cursor'] = 'hand2'
200
+
201
+
202
+
203
+
204
+
205
+
206
+
207
+
208
+
209
+ if __name__ == '__main__':
210
+
211
+
212
+
213
+ #世間でいうrootをappとしています
214
+
215
+ app = Tk()
216
+
217
+
218
+
219
+ #実行端末の画面サイズを取得
220
+
221
+ ww = app.winfo_screenwidth()
222
+
223
+ wh = app.winfo_screenheight()
224
+
225
+
226
+
227
+ app.update_idletasks()
228
+
229
+
230
+
231
+ #フォームサイズを実行端末から導き、ド真中に配置表示
232
+
233
+ lw = math.ceil(ww * 0.208)
234
+
235
+ lh = math.ceil(wh * 0.277)
236
+
237
+ app.geometry(str(lw)+"x"+str(lh)+"+"+str(int(ww/2-lw/2))+"+"+str(int(wh/2-lh/2)) )
238
+
239
+
240
+
241
+ #タイトルを指定
242
+
243
+ app.title("Main Menu")
244
+
245
+
246
+
247
+ #フォームの最大化、×ボタン操作を無効化
248
+
249
+ app.resizable(0,0)
250
+
251
+ #app.protocol('WM_DELETE_WINDOW', (lambda: 'pass')())
252
+
253
+
254
+
255
+ # カーソル変更
256
+
257
+ app["cursor"] = "hand2"
258
+
259
+
260
+
261
+ app.configure(bg="#F0FFFF")
262
+
263
+
264
+
265
+ # フレームを作成する
266
+
267
+ frame = Apprication(app)
268
+
269
+ # 格納したTkインスタンスのmainloopで画面を起こす
270
+
271
+ app.mainloop()
272
+
273
+
274
+
275
+ ```

3

画像追加

2020/05/15 07:42

投稿

saya24
saya24

スコア222

test CHANGED
File without changes
test CHANGED
@@ -27,3 +27,11 @@
27
27
 
28
28
 
29
29
  何かの設定が足りないがため 他人様より開発がしづらい環境で作業を行っていないか?と 少々気になりましたので 問い合わせさせて頂きました。
30
+
31
+
32
+
33
+
34
+
35
+ ### 2020/05/14 21;54 追加
36
+
37
+ ![イメージ説明](5603fdd16794692c1f8720554d31342b.png)

2

タイトル変更

2020/05/14 12:57

投稿

saya24
saya24

スコア222

test CHANGED
@@ -1 +1 @@
1
- Python: 開発時(デバッグ実行時)に検出されるSyntaxエラーの解析方法を 効率化したい
1
+ Python: 開発時(デバッグ実行時)に検出されるエラーの解析方法を 効率化したい
test CHANGED
File without changes

1

コード追加

2020/05/14 07:23

投稿

saya24
saya24

スコア222

test CHANGED
File without changes
test CHANGED
@@ -3,6 +3,14 @@
3
3
  開発環境は人それぞれであること、を理由に若干回答はつきにくい可能性がありますが、これからの開発作業を考慮し、恥を忍んでお聞きします。
4
4
 
5
5
  ![画面イメージを生成できない時](ce5157cb0f55a2779efe157badd7fe64.png)
6
+
7
+ ```Python
8
+
9
+ btn2 = Button(self.dialog, width=10, image="images\excel.png", command=outCsv)
10
+
11
+ btn2.grid(row=5, column=9, pady=10)
12
+
13
+ ```
6
14
 
7
15
 
8
16