mirror of
https://github.com/ocogeclub/ocoge.git
synced 2024-11-21 23:29:48 +00:00
[update] pybfm.py を TkinterDnD2 がなくても起動するよう変更
This commit is contained in:
parent
36c3497492
commit
e92fbfc6ed
4
.gitignore
vendored
4
.gitignore
vendored
@ -6,5 +6,7 @@ build/
|
|||||||
*.bak
|
*.bak
|
||||||
*.old
|
*.old
|
||||||
|
|
||||||
|
|
||||||
out/
|
out/
|
||||||
|
|
||||||
|
.mypy_cache
|
||||||
|
tkinterdnd2
|
Binary file not shown.
@ -1,7 +1,12 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
from tkinter import *
|
from tkinter import *
|
||||||
|
try:
|
||||||
from tkinterdnd2 import *
|
from tkinterdnd2 import *
|
||||||
|
except ImportError:
|
||||||
|
dnd = False
|
||||||
|
else:
|
||||||
|
dnd = True
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import pyboard
|
import pyboard
|
||||||
@ -174,7 +179,10 @@ def do_nothing():
|
|||||||
##### メイン #####
|
##### メイン #####
|
||||||
|
|
||||||
# メインウィンドウの生成
|
# メインウィンドウの生成
|
||||||
|
if dnd:
|
||||||
root = TkinterDnD.Tk()
|
root = TkinterDnD.Tk()
|
||||||
|
else:
|
||||||
|
root = Tk()
|
||||||
root.title('PyBfm')
|
root.title('PyBfm')
|
||||||
root.geometry('400x300')
|
root.geometry('400x300')
|
||||||
pmenu = Menu(root, tearoff=0)
|
pmenu = Menu(root, tearoff=0)
|
||||||
@ -191,6 +199,7 @@ pmenu.add_command(label="閉じる", command=do_nothing)
|
|||||||
frame = Frame(root)
|
frame = Frame(root)
|
||||||
# Listboxウィジェットの生成
|
# Listboxウィジェットの生成
|
||||||
listbox = Listbox(frame, selectmode=EXTENDED)
|
listbox = Listbox(frame, selectmode=EXTENDED)
|
||||||
|
if dnd:
|
||||||
listbox.drop_target_register(DND_FILES)
|
listbox.drop_target_register(DND_FILES)
|
||||||
listbox.dnd_bind('<<Drop>>', listbox_drop)
|
listbox.dnd_bind('<<Drop>>', listbox_drop)
|
||||||
listbox.bind("<KeyPress>", input_key)
|
listbox.bind("<KeyPress>", input_key)
|
||||||
|
Loading…
Reference in New Issue
Block a user