summaryrefslogtreecommitdiffstats
path: root/Lib/idlelib/keybindingDialog.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/idlelib/keybindingDialog.py')
-rw-r--r--Lib/idlelib/keybindingDialog.py13
1 files changed, 7 insertions, 6 deletions
diff --git a/Lib/idlelib/keybindingDialog.py b/Lib/idlelib/keybindingDialog.py
index 5339f88..0f0da8c 100644
--- a/Lib/idlelib/keybindingDialog.py
+++ b/Lib/idlelib/keybindingDialog.py
@@ -1,9 +1,10 @@
"""
Dialog for building Tkinter accelerator key bindings
"""
-from Tkinter import *
-import tkMessageBox
+from tkinter import *
+import tkinter.messagebox as tkMessageBox
import string
+from idlelib import macosxSupport
class GetKeysDialog(Toplevel):
def __init__(self,parent,title,action,currentKeySequences):
@@ -132,7 +133,7 @@ class GetKeysDialog(Toplevel):
order is also important: key binding equality depends on it, so
config-keys.def must use the same ordering.
"""
- from idlelib import macosxSupport
+ import sys
if macosxSupport.runningAsOSXApp():
self.modifiers = ['Shift', 'Control', 'Option', 'Command']
else:
@@ -163,7 +164,7 @@ class GetKeysDialog(Toplevel):
if finalKey:
finalKey = self.TranslateKey(finalKey, modifiers)
keyList.append(finalKey)
- self.keyString.set('<' + string.join(keyList,'-') + '>')
+ self.keyString.set('<' + '-'.join(keyList) + '>')
def GetModifiers(self):
modList = [variable.get() for variable in self.modifier_vars]
@@ -203,7 +204,7 @@ class GetKeysDialog(Toplevel):
'/':'slash','?':'question','Page Up':'Prior','Page Down':'Next',
'Left Arrow':'Left','Right Arrow':'Right','Up Arrow':'Up',
'Down Arrow': 'Down', 'Tab':'Tab'}
- if key in translateDict.keys():
+ if key in translateDict:
key = translateDict[key]
if 'Shift' in modifiers and key in string.ascii_lowercase:
key = key.upper()
@@ -263,6 +264,6 @@ if __name__ == '__main__':
def run():
keySeq=''
dlg=GetKeysDialog(root,'Get Keys','find-again',[])
- print dlg.result
+ print(dlg.result)
Button(root,text='Dialog',command=run).pack()
root.mainloop()