0% found this document useful (0 votes)
146 views

Python With Qtcreator

Qt Creator allows creating and running Python files but lacks features like autocomplete. Running scripts requires configuring external tools to specify the Python executable, script file path, and working directory. This enables running scripts from the Tools menu. PyUIC can also be configured as an external tool to compile UI files. Keyboard shortcuts for the tools should then be configured.

Uploaded by

rajeshbhansali
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
146 views

Python With Qtcreator

Qt Creator allows creating and running Python files but lacks features like autocomplete. Running scripts requires configuring external tools to specify the Python executable, script file path, and working directory. This enables running scripts from the Tools menu. PyUIC can also be configured as an external tool to compile UI files. Keyboard shortcuts for the tools should then be configured.

Uploaded by

rajeshbhansali
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Currently, Qt Creator allows you to create Python files (not projects) and run them.

It also has syntax highlighting, but it lacks more complex features such as
autocomplete.

Running scripts requires some configuration (I used this tutorial).

Open Qt Creator and go to Tools->Options->Environment->External Tools.

Click Add->Add category and create a new category (for example, Python).

Then, select the created category and click Add->Add Tool to create a new tool

- RunPy for example. Select the created tool and fill the fields on the right:

Description - any value

Executable - path to python.exe

Arguments - %{CurrentDocument:FilePath}

Working directory - %{CurrentDocument:Path}

Environment - QT_LOGGING_TO_CONSOLE=1

You get something like this:

enter image description here

Now, go to File->New File or Project->Python and select Python source file.

To run the created script: Tools->External->Python->RunPy.

You can also add pyuic to it the same way: Click again on the Add->Add Tool button to

create a new tool - PyUic now. Select it again and fill the fields on the right:
Description - any value

Executable - path to pyuic5

Arguments - -o UI%{CurrentDocument:FileBaseName}.py -x %
{CurrentDocument:FilePath}

Working directory - %{CurrentDocument:Path}

Environment - QT_LOGGING_TO_CONSOLE=1

Then you should have PyUic connected as well.

Also configure keyboard shortcuts afterwards

Source:

http://stackoverflow.com/a/24121860

You might also like