Skip to content

Commit c8fe948

Browse files
committed
Add "Interactive python" button
1 parent 354284c commit c8fe948

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

main.py

+19-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import sys
77
import time
88
from imgui.integrations.nx import NXRenderer
9-
from nx.utils import clear_terminal
9+
from nx.utils import clear_terminal, Terminal
1010
import traceback
1111

1212
sys.argv = [""] # workaround needed for runpy
@@ -21,6 +21,7 @@ def colorToFloat(t):
2121
FOLDER_COLOR = colorToFloat((230, 126, 34))
2222
PYFILE_COLOR = colorToFloat((46, 204, 113))
2323
FILE_COLOR = colorToFloat((41, 128, 185))
24+
APP_COLOR = colorToFloat((24, 86, 31))
2425

2526
ERROR = ""
2627

@@ -55,6 +56,8 @@ def main():
5556
imgui.begin("",
5657
flags=imgui.WINDOW_NO_TITLE_BAR | imgui.WINDOW_NO_RESIZE | imgui.WINDOW_NO_MOVE | imgui.WINDOW_NO_SAVED_SETTINGS
5758
)
59+
imgui.begin_group()
60+
5861
imgui.text("Welcome to PyNX!")
5962
imgui.text("Touch is supported")
6063
imgui.text("Current dir: " + os.getcwd())
@@ -92,6 +95,21 @@ def main():
9295
run_python_module(e)
9396

9497
imgui.pop_style_color(1)
98+
99+
imgui.end_group()
100+
# end of file picker
101+
102+
imgui.same_line(spacing=50)
103+
imgui.begin_group()
104+
imgui.text("Utils:")
105+
106+
imgui.push_style_color(imgui.COLOR_BUTTON, *APP_COLOR)
107+
if imgui.button("Interactive Python", width=200, height=60):
108+
t = Terminal()
109+
t.main()
110+
imgui.pop_style_color(1)
111+
112+
imgui.end_group()
95113

96114

97115
imgui.end()

0 commit comments

Comments
 (0)