Recently I got an invitation to OpenAI Codex, an AI tool that learn from all Github open source code and is capable to generate new code… I cant stop to test it!..
One of the things I tried is to generate UIs directly from description. and it worked! It works for python wxwidgets, pyqt and even for lvgl. Not always of course, but simple examples work. I dont know why but it generates v7 API…
So given the prompt:
# This example shows a window with 5 elements:
# - A dropdown list, named "com_port", with different COM ports.
# - A dropdown list, named "test", with different tests.
# - A button, named "exec_one" (with same text), to execute only one test.
# - A button, named "exec_all"(with same text), to execute all tests.
# - A label, named "result"(with same text) with the test/s result.
import lvgl as lv
scr = lv.obj()
Generates:
(in the generated code, I added the button labels cause tries to set with button.set_text)
If I change to “import wx” generates a complete wxwidgets running app:
Importing PyQt5 also works
The lvgl can be readed on the screenshot, but wx and qt are a little bit longer. I think is also curios for ppl read them so I attached here. These examples arent modified by me (exept that on wx example, it generated python2 print statemets, so I added parentesis )
UI Codex.zip (2.5 KB)