Changeset View
Changeset View
Standalone View
Standalone View
user_manual/python_scripting/introduction_to_python_scripting.rst
Show First 20 Lines • Show All 70 Lines • ▼ Show 20 Line(s) | 70 | .. code:: python | |||
---|---|---|---|---|---|
71 | 71 | | |||
72 | from krita import * | 72 | from krita import * | ||
73 | 73 | | |||
74 | d = Krita.instance().createDocument(512, 512, "Python test document", "RGBA", "U8", "", 120.0) | 74 | d = Krita.instance().createDocument(512, 512, "Python test document", "RGBA", "U8", "", 120.0) | ||
75 | Krita.instance().activeWindow().addView(d) | 75 | Krita.instance().activeWindow().addView(d) | ||
76 | 76 | | |||
77 | This will open up a new document. Clearly Python gives you quite a lot of control to automate Krita. Over time we expect the community to write all kinds of scripts that you can use simply by pasting them in the scripter. | 77 | This will open up a new document. Clearly Python gives you quite a lot of control to automate Krita. Over time we expect the community to write all kinds of scripts that you can use simply by pasting them in the scripter. | ||
78 | 78 | | |||
79 | But what if you want to write new commands for yourself? The best place to start is very simple: search for examples written by other people! You can save a lot of time if someone else has written code that you can base your work on. It's also worth looking through the python plugins, which are located in /share/krita/pykrita. Ther's also a step by step guide for :ref:`krita_python_plugin_howto` here in the manual. | 79 | But what if you want to write new commands for yourself? The best place to start is very simple: search for examples written by other people! You can save a lot of time if someone else has written code that you can base your work on. It's also worth looking through the python plugins, which are located in /share/krita/pykrita. There's also a step by step guide for :ref:`krita_python_plugin_howto` here in the manual. | ||
80 | 80 | | |||
81 | But it's likely that you need more information. For that, we will need see what's hidden behind the asterisk when you ``import * from Krita``. To learn what Krita functions that are available and how to use them, you will want to go for Krita API reference documentation. | 81 | But it's likely that you need more information. For that, we will need see what's hidden behind the asterisk when you ``import * from Krita``. To learn what Krita functions that are available and how to use them, you will want to go for Krita API reference documentation. | ||
82 | 82 | | |||
83 | Krita's API | 83 | Krita's API | ||
84 | ~~~~~~~~~~~ | 84 | ~~~~~~~~~~~ | ||
85 | 85 | | |||
86 | - `LibKis API Overview <https://api.kde.org/extragear-api/graphics-apidocs/krita/libs/libkis/html/index.html>`_ | 86 | - `LibKis API Overview <https://api.kde.org/extragear-api/graphics-apidocs/krita/libs/libkis/html/index.html>`_ | ||
87 | - `Krita class documentation <https://api.kde.org/extragear-api/graphics-apidocs/krita/libs/libkis/html/classKrita.html>`_ | 87 | - `Krita class documentation <https://api.kde.org/extragear-api/graphics-apidocs/krita/libs/libkis/html/classKrita.html>`_ | ||
▲ Show 20 Lines • Show All 101 Lines • Show Last 20 Lines |