Skip to content

Commit b6be3d4

Browse files
authored
BINPython 0.14
Add GUI Support Add Warming Fix Ctrl+C Error Fix Exit program error
1 parent e86fa71 commit b6be3d4

File tree

1 file changed

+62
-26
lines changed

1 file changed

+62
-26
lines changed

binpython.py

Lines changed: 62 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,42 @@
11
#BINPython By:XINGYUJIE AGPL-V3.0 LECENSE Release
22
#Please follow the LICENSE
3+
4+
#base import
35
import getopt
46
import sys
57
import platform
8+
#gui import
9+
try:
10+
import tkinter
11+
import turtle
12+
#warning for gui
13+
except:
14+
print("Warning: Some GUI (graphical) libraries for BINPython do not exist, such as tkinter and turtle. Because they are not built when they are built. If you need to fix this warning, please complete the support libraries imported in the source code at build time (use pip or build it yourself), if your system does not support these libraries, you can remove or change this hint in the source code and rebuild")
15+
print("")
16+
17+
#import math
18+
try:
19+
import fractions
20+
import cmath
21+
except:
22+
print("Warning: Some math or computation libraries for BINPython do not exist, such as fractions and cmath. Because they weren't built when they were built. If you need to fix this warning, please complete the support libraries imported in the source code when building (use pip or build it yourself), if your system does not support these libraries, you can remove or change this prompt in the source code and rebuild")
23+
print("")
24+
#rlcompleter
25+
#import for normal
26+
try:
27+
#str
28+
import rlcompleter
29+
import array
30+
except:
31+
print("Warning: Some libraries for functions, data types, etc. for BINPython do not exist, such as rlcomplter and array. Because they weren't built when they were built. If you need to fix this warning, please complete the support libraries imported in the source code when building (use pip or build it yourself), if your system does not support these libraries, you can remove or change this prompt in the source code and rebuild")
32+
print("")
33+
try:
34+
import filecmp
35+
import tempfile
36+
except:
37+
print("Warning: Some file manipulation libraries for BINPython do not exist, such as filecmp and tempfile. Because they weren't built when they were built. If you need to fix this warning, please complete the support libraries imported in the source code when building (use pip or build it yourself), if your system does not support these libraries, you can remove or change this prompt in the source code and rebuild")
38+
print("")
39+
#getopt
640
opts,args = getopt.getopt(sys.argv[1:],'-h-f:-v',['help','file=','version'])
741
for opt_name,opt_value in opts:
842
if opt_name in ('-h','--help'):
@@ -14,34 +48,32 @@
1448
""")
1549
sys.exit()
1650
if opt_name in ('-v','--version'):
17-
print("BINPython By:XINGYUJIE[https://github.com/xingyujie] AGPL-3.0 LICENSE Release")
51+
print("BINPython By:XINGYUJIE[https://github.com/xingyujie/binpython] AGPL-3.0 LICENSE Release")
1852
print("Python " + platform.python_version())
1953
exit()
2054
if opt_name in ('-f','--file'):
2155
file = opt_value
22-
#print("[*] Filename is ",file)
2356
f = open(file,encoding = "utf-8")
2457
exec(f.read())
25-
#codeline=f.read()
26-
#codeline
2758
input("Please enter to continue")
2859
sys.exit()
60+
#main BINPython
2961

30-
print("BINPython 0.12 (Python Version:" + platform.python_version() + ")By:XINGYUJIE https://github.com/xingyujie[Running on " + platform.platform() + " " + platform.version() + "]")
62+
print("BINPython 0.14 (Python Version:" + platform.python_version() + ")By:XINGYUJIE https://github.com/xingyujie/binpython[Running on " + platform.platform() + " " + platform.version() + "]")
3163
print('Type "about", "help", "copyright", "credits" or "license" for more information.')
32-
33-
while True:
34-
x=input('>>> ')
35-
if x in globals().keys():
36-
print(globals()[x])
37-
continue
38-
elif x == 'about':
39-
print("BINPython By:XINGYUJIE[https://github.com/xingyujie] AGPL-3.0 LICENSE Release")
40-
elif x == 'help':
41-
print("Type help() for interactive help, or help(object) for help about object.")
42-
elif x == 'copyright':
43-
print("""
44-
Copyright (c) 2001-2022 Python Software Foundation and BINPython xingyujie(https://github.com/xingyujie).
64+
try:
65+
while True:
66+
pycmd=input('>>> ')
67+
if pycmd in globals().keys():
68+
print(globals()[pycmd])
69+
continue
70+
elif pycmd == 'about':
71+
print("BINPython By:XINGYUJIE[https://github.com/xingyujie] AGPL-3.0 LICENSE Release")
72+
elif pycmd == 'help':
73+
print("Type help() for interactive help, or help(object) for help about object.")
74+
elif pycmd == 'copyright':
75+
print("""
76+
Copyright (c) 2001-2022 Python Software Foundation and BINPython xingyujie(https://github.com/xingyujie/binpython).
4577
All Rights Reserved.
4678
4779
Copyright (c) 2000 BeOpen.com.
@@ -53,14 +85,18 @@
5385
Copyright (c) 1991-1995 Stichting Mathematisch Centrum, Amsterdam.
5486
All Rights Reserved.
5587
""")
56-
elif x == 'credits':
57-
print("""
88+
elif pycmd == 'credits':
89+
print("""
5890
Thanks to CWI, CNRI, BeOpen.com, Zope Corporation and a cast of thousands
5991
for supporting Python development. See www.python.org for more information.
6092
""")
61-
elif x == 'license':
62-
print("Type license() to see the full license text")
63-
try:
64-
exec(x)
65-
except Exception as err:
66-
print(err)
93+
elif pycmd == 'license':
94+
print("Type license() to see the full license text")
95+
try:
96+
exec(pycmd)
97+
except Exception as err:
98+
print(err)
99+
except KeyboardInterrupt:
100+
print("EXIT!")
101+
sys.exit()
102+

0 commit comments

Comments
 (0)