-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmod_idle3.12.py
More file actions
33 lines (32 loc) · 1.17 KB
/
Copy pathmod_idle3.12.py
File metadata and controls
33 lines (32 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
from sys import version_info
try:
assert version_info[0]==3 and (version_info[1]==12 or version_info[1]==13)
import idlelib.editor
file=idlelib.editor.__file__
first=second=third=fourth=''
line=0
with open(file)as f,open(file+'.bak','w')as f2:f2.write(f.read())#Preserve the original just in case
with open(file)as f:#Read and split
while l:=f.readline():
line+=1
if line<=136:first+=l
elif line<=227:second+=l
elif line<=549:third+=l
else:fourth+=l
with open(file,'w')as f:#Apply mod
f.write(first)
f.write(" self.hbar = hbar = Scrollbar(text_frame, orient='horizontal',name='hbar')\n")
f.write(second)
f.write(''' hbar['command'] = self.handle_xview
hbar.grid(row=2, column=1, sticky=NSEW)
text['xscrollcommand'] = hbar.set
''')
f.write(third)
f.write(''' def handle_xview(self, event, *args):
self.text.xview(event, *args)
return 'break'
''')
f.write(fourth)
print('Done!')
except AssertionError:
print('You are not using Python 3.12 or Python 3.13')