質問編集履歴
1
main, cursorのモジュールを追加しました。
test
CHANGED
File without changes
|
test
CHANGED
@@ -226,8 +226,340 @@
|
|
226
226
|
|
227
227
|
|
228
228
|
|
229
|
+
```Python
|
230
|
+
|
231
|
+
#main.py
|
232
|
+
|
233
|
+
|
234
|
+
|
235
|
+
import tkinter as tk
|
236
|
+
|
237
|
+
import tkinter.ttk as ttk
|
238
|
+
|
239
|
+
|
240
|
+
|
241
|
+
win = tk.Tk()
|
242
|
+
|
243
|
+
win.title('ダメージ計算')
|
244
|
+
|
245
|
+
win.geometry('500x600')
|
246
|
+
|
247
|
+
|
248
|
+
|
249
|
+
atkframe = tk.Frame(win)
|
250
|
+
|
251
|
+
atkframe.pack(pady = 5)
|
252
|
+
|
253
|
+
|
254
|
+
|
255
|
+
nameframe = tk.Frame(atkframe)
|
256
|
+
|
257
|
+
nameframe.pack(pady = 5)
|
258
|
+
|
259
|
+
alabel = tk.Label(nameframe, text = "攻撃側 ")
|
260
|
+
|
261
|
+
alabel.pack(side = 'left')
|
262
|
+
|
263
|
+
aname = tk.Entry(nameframe, name = 'aname')
|
264
|
+
|
265
|
+
aname.pack(side = 'left')
|
266
|
+
|
267
|
+
aname.insert(index = 'insert', string = "インテレオン")
|
268
|
+
|
269
|
+
|
270
|
+
|
271
|
+
lvframe = tk.Frame(atkframe)
|
272
|
+
|
273
|
+
lvframe.pack(pady = 5)
|
274
|
+
|
275
|
+
alvlabel = tk.Label(lvframe, text = "レベル ")
|
276
|
+
|
277
|
+
alvlabel.pack(side = 'left')
|
278
|
+
|
279
|
+
alventry = tk.Entry(lvframe)
|
280
|
+
|
281
|
+
alventry.pack(side = 'left')
|
282
|
+
|
283
|
+
alventry.insert(index = 'insert', string = '50')
|
284
|
+
|
285
|
+
|
286
|
+
|
287
|
+
idframe = tk.Frame(atkframe)
|
288
|
+
|
289
|
+
idframe.pack(pady = 5)
|
290
|
+
|
291
|
+
aivlabel = tk.Label(idframe, text = "個体値 ")
|
292
|
+
|
293
|
+
aivlabel.pack(side = 'left', ipadx = 5)
|
294
|
+
|
295
|
+
aiventry = tk.Entry(idframe)
|
296
|
+
|
297
|
+
aiventry.pack(side = 'left')
|
298
|
+
|
299
|
+
aiventry.insert(index = 'insert', string = '31')
|
300
|
+
|
301
|
+
|
302
|
+
|
303
|
+
aevlabel = tk.Label(idframe, text = "努力値 ")
|
304
|
+
|
305
|
+
aevlabel.pack(side = 'left')
|
306
|
+
|
307
|
+
aeventry = tk.Entry(idframe)
|
308
|
+
|
309
|
+
aeventry.pack(side = 'left', ipadx = 5)
|
310
|
+
|
311
|
+
aeventry.insert(index = 'insert', string = '252')
|
312
|
+
|
313
|
+
|
314
|
+
|
315
|
+
natureframe = tk.Frame(atkframe)
|
316
|
+
|
317
|
+
natureframe.pack(pady = 8)
|
318
|
+
|
319
|
+
anaturelabel = tk.Label(natureframe, text = "性格 ")
|
320
|
+
|
321
|
+
anaturelabel.pack(side = 'left')
|
322
|
+
|
323
|
+
anaturecheck = ttk.Combobox(natureframe, state = 'readonly')
|
324
|
+
|
325
|
+
anaturecheck['values'] = ("", "さみしがり", "いじっぱり", "やんちゃ", "ゆうかん", "ずぶとい", "わんぱく", "のうてんき", "のんき", "ひかえめ", "おっとり", "うっかりや", "れいせい", "おだやか", "おとなしい", "しんちょう", "なまいき", "おくびょう", "せっかち", "ようき", "むじゃき", "てれや", "がんばりや", "すなお", "きまぐれ", "まじめ")
|
326
|
+
|
327
|
+
anaturecheck.current(0)
|
328
|
+
|
329
|
+
anaturecheck.pack(side = 'left')
|
330
|
+
|
331
|
+
|
332
|
+
|
333
|
+
moveframe = tk.Frame(atkframe)
|
334
|
+
|
335
|
+
moveframe.pack()
|
336
|
+
|
337
|
+
mlabel = tk.Label(moveframe, text = "わざ名 ")
|
338
|
+
|
339
|
+
mlabel.pack()
|
340
|
+
|
341
|
+
mname = tk.Entry(moveframe)
|
342
|
+
|
343
|
+
mname.pack()
|
344
|
+
|
345
|
+
mname.insert(index = 'insert', string = "")
|
346
|
+
|
347
|
+
|
348
|
+
|
349
|
+
defframe = tk.Frame(win)
|
350
|
+
|
351
|
+
defframe.pack(pady = 15)
|
352
|
+
|
353
|
+
|
354
|
+
|
355
|
+
nameframe = tk.Frame(defframe)
|
356
|
+
|
357
|
+
nameframe.pack(pady = 5)
|
358
|
+
|
359
|
+
dlabel = tk.Label(nameframe, text = "防御側 ")
|
360
|
+
|
361
|
+
dlabel.pack(side = 'left')
|
362
|
+
|
363
|
+
dname = tk.Entry(nameframe)
|
364
|
+
|
365
|
+
dname.pack(side = 'left')
|
366
|
+
|
367
|
+
dname.insert(index = 'insert', string = "エースバーン")
|
368
|
+
|
369
|
+
|
370
|
+
|
371
|
+
lvframe = tk.Frame(defframe)
|
372
|
+
|
373
|
+
lvframe.pack(pady = 5)
|
374
|
+
|
375
|
+
dlvlabel = tk.Label(lvframe, text = "レベル ")
|
376
|
+
|
377
|
+
dlvlabel.pack(side = 'left')
|
378
|
+
|
379
|
+
dlventry = tk.Entry(lvframe)
|
380
|
+
|
381
|
+
dlventry.pack(side = 'left')
|
382
|
+
|
383
|
+
dlventry.insert(index = 'insert', string = '50')
|
384
|
+
|
385
|
+
|
386
|
+
|
387
|
+
idframe = tk.Frame(defframe)
|
388
|
+
|
389
|
+
idframe.pack(pady = 5)
|
390
|
+
|
391
|
+
divlabel = tk.Label(idframe, text = "個体値 ")
|
392
|
+
|
393
|
+
divlabel.pack(side = 'left', ipadx = 5)
|
394
|
+
|
395
|
+
diventry = tk.Entry(idframe)
|
396
|
+
|
397
|
+
diventry.pack(side = 'left')
|
398
|
+
|
399
|
+
diventry.insert(index = 'insert', string = '31')
|
400
|
+
|
401
|
+
|
402
|
+
|
403
|
+
devlabel = tk.Label(idframe, text = "努力値 ")
|
404
|
+
|
405
|
+
devlabel.pack(side = 'left')
|
406
|
+
|
407
|
+
deventry = tk.Entry(idframe)
|
408
|
+
|
409
|
+
deventry.pack(side = 'left', ipadx = 5)
|
410
|
+
|
411
|
+
deventry.insert(index = 'insert', string = '252')
|
412
|
+
|
413
|
+
|
414
|
+
|
415
|
+
natureframe = tk.Frame(defframe)
|
416
|
+
|
417
|
+
natureframe.pack(pady = 8)
|
418
|
+
|
419
|
+
dnaturelabel = tk.Label(natureframe, text = "性格 ")
|
420
|
+
|
421
|
+
dnaturelabel.pack(side = 'left')
|
422
|
+
|
423
|
+
dnaturecheck = ttk.Combobox(natureframe)
|
424
|
+
|
425
|
+
dnaturecheck['values'] = ("", "さみしがり", "いじっぱり", "やんちゃ", "ゆうかん", "ずぶとい", "わんぱく", "のうてんき", "のんき", "ひかえめ", "おっとり", "うっかりや", "れいせい", "おだやか", "おとなしい", "しんちょう", "なまいき", "おくびょう", "せっかち", "ようき", "むじゃき", "てれや", "がんばりや", "すなお", "きまぐれ", "まじめ")
|
426
|
+
|
427
|
+
dnaturecheck.current(0)
|
428
|
+
|
429
|
+
dnaturecheck.pack(side = 'left')
|
430
|
+
|
431
|
+
```
|
432
|
+
|
433
|
+
|
434
|
+
|
435
|
+
```Python
|
436
|
+
|
437
|
+
#cursor.py
|
438
|
+
|
439
|
+
|
440
|
+
|
441
|
+
import tkinter as tk
|
442
|
+
|
443
|
+
import sqlite3 as sql
|
444
|
+
|
445
|
+
import tkinter.ttk as ttk
|
446
|
+
|
447
|
+
|
448
|
+
|
449
|
+
import main
|
450
|
+
|
451
|
+
|
452
|
+
|
453
|
+
main
|
454
|
+
|
455
|
+
|
456
|
+
|
457
|
+
dbpath = "dex.sqlite3"
|
458
|
+
|
459
|
+
conn = sql.connect(dbpath)
|
460
|
+
|
461
|
+
cur = conn.cursor()
|
462
|
+
|
463
|
+
|
464
|
+
|
465
|
+
cur.execute("SELECT type1 FROM dex WHERE name = '%s'" % main.aname.get())
|
466
|
+
|
467
|
+
at1 = cur.fetchone()
|
468
|
+
|
469
|
+
cur.execute("SELECT type2 FROM dex WHERE name = '%s'" % main.aname.get())
|
470
|
+
|
471
|
+
at2 = cur.fetchone()
|
472
|
+
|
473
|
+
cur.execute("SELECT A FROM dex WHERE name = '%s'" % main.aname.get())
|
474
|
+
|
475
|
+
A = cur.fetchone()
|
476
|
+
|
477
|
+
cur.execute("SELECT C FROM dex WHERE name = '%s'" % main.aname.get())
|
478
|
+
|
479
|
+
C = cur.fetchone()
|
480
|
+
|
481
|
+
cur.execute("SELECT S FROM dex WHERE name = '%s'" % main.aname.get())
|
482
|
+
|
483
|
+
aS = cur.fetchone()
|
484
|
+
|
485
|
+
|
486
|
+
|
487
|
+
cur.execute("SELECT type1 FROM dex WHERE name = '%s'" % main.dname.get())
|
488
|
+
|
489
|
+
dt1 = cur.fetchone()
|
490
|
+
|
491
|
+
cur.execute("SELECT type2 FROM dex WHERE name = '%s'" % main.aname.get())
|
492
|
+
|
493
|
+
dt2 = cur.fetchone()
|
494
|
+
|
495
|
+
cur.execute("SELECT H FROM dex WHERE name = '%s'" % main.dname.get())
|
496
|
+
|
497
|
+
H = cur.fetchone()
|
498
|
+
|
499
|
+
cur.execute("SELECT B FROM dex WHERE name = '%s'" % main.dname.get())
|
500
|
+
|
501
|
+
B = cur.fetchone()
|
502
|
+
|
503
|
+
cur.execute("SELECT D FROM dex WHERE name = '%s'" % main.dname.get())
|
504
|
+
|
505
|
+
D = cur.fetchone()
|
506
|
+
|
507
|
+
cur.execute("SELECT S FROM dex WHERE name = '%s'" % main.dname.get())
|
508
|
+
|
509
|
+
dS = cur.fetchone()
|
510
|
+
|
511
|
+
|
512
|
+
|
513
|
+
cur.execute("SELECT type FROM moves WHERE name = '%s'" % main.mname.get())
|
514
|
+
|
515
|
+
mtype = cur.fetchone()
|
516
|
+
|
517
|
+
cur.execute("SELECT mtype FROM moves WHERE name = '%s'" % main.mname.get())
|
518
|
+
|
519
|
+
mmtype = cur.fetchone()
|
520
|
+
|
521
|
+
cur.execute("SELECT power FROM moves WHERE name = '%s'" % main.mname.get())
|
522
|
+
|
523
|
+
mpower = cur.fetchone()
|
524
|
+
|
525
|
+
|
526
|
+
|
527
|
+
cur.execute("SELECT rev FROM types WHERE type1 = '%s' AND type2 = '%s'" % (mtype, dt1))
|
528
|
+
|
529
|
+
rev1 = cur.fetchone()
|
530
|
+
|
531
|
+
cur.execute("SELECT rev FROM types WHERE type1 = '%s' AND type2 = '%s'"% (mtype, dt2))
|
532
|
+
|
533
|
+
rev2 = cur.fetchone()
|
534
|
+
|
535
|
+
|
536
|
+
|
537
|
+
main.win.mainloop()
|
538
|
+
|
539
|
+
|
540
|
+
|
541
|
+
if __name__ == "__main__":
|
542
|
+
|
543
|
+
|
544
|
+
|
545
|
+
main
|
546
|
+
|
547
|
+
main.win.mainloop()
|
548
|
+
|
549
|
+
```
|
550
|
+
|
551
|
+
|
552
|
+
|
229
553
|
### 試したこと
|
230
554
|
|
231
555
|
|
232
556
|
|
233
557
|
buttonモジュールのcommandを片方のみにするなど、変更をしましたが、上記と全く同じエラーコードが出ました。
|
558
|
+
|
559
|
+
|
560
|
+
|
561
|
+
### 補足
|
562
|
+
|
563
|
+
|
564
|
+
|
565
|
+
cursor.pyの中でもrev1のほうでsyntax errorが出ています。図々しいですが、よければこちらも教えてもらえればありがたいです。
|