How to create a console in GUI app using pyqt?
-
Does anyone have an idea?
I used QTextEdit and QLineEdit to create a console.
I used eval to run custom command.
Is it the correct method to do it? -
@Moeka_Chan said in How to create a console in GUI app using pyqt?:
Is it the correct method to do it?
Depends on what you mean with "console". Do you want to embed the console of your system (which OS is it?) into your app?
-
@Moeka_Chan Did you already check this: https://docs.python.org/2/extending/embedding.html
-
@Denni-0 I want to interact with the terminal window. I am a Blender user. I can create a customized class or function to run in Blender. I think I need to create a widget for a console to be added in my App. There is no console widget, but PyqtGraph has consolewidget. I also checked console application, script window, command window, console interface, dev console. Because they are shown in App GUI, I don't know what correct word to search...
One more question, some games have their own console. For example, players can change a mouse cursor size or select game server in Dota 2 console. I am not sure whether I can create some variables, like a = 2, in Dota 2 console. (I didn't test it before). Do you have any ideas on how to create this console?
-
@Denni-0
I want to create my own program that has a console. It is like Command Window in Matlab or Console in Blender, which is shown in the red rectangle in the images above. -
@Denni-0 Most of the software I used has a scripting section. For example, Motionbuilder, Maya, Blender, Unity, Matlab... Users can write their scripts to run there. Currently, I am not going to add this feature in my program. Usually, the scripting section includes TextEdit for scripting and a console to run some internal functions or execute the scripts. I am going to create a console in my program, but I have no blueprint on it. I found a tutorial showing how to create a dev console on a webpage, and it used TextEdit and LineEdit to achieve it. However, the console in the tutorial only works for customized command. It can't run any Python, Java method.....
-
@Denni-0 wrap it and then call a python or command line execute function to run it
Does it use methods like eval, subprocess?