It looks like you're new here. If you want to get involved, click one of these buttons!
Hi sir,
Here was my input form in tcl
as you can see the UI input table ,I can make 2 or more input item as this code.
set f [frame .top.f2]
pack $f -fill both -pady 5
label $f.lab3 -text "for Oval long-side:" -width 25 -anchor w
label $f.lab4 -text "short-side:" -width 12 -anchor w
entry $f.ent3 -bg white -textvariable BiasL -width 10
entry $f.ent4 -bg white -textvariable BiasS -width 10
pack $f.lab3 $f.ent3 $f.lab4 $f.ent4 -side left -padx 5
But , in the Klayout Ruby (DRC) ,
Here was my code , I can just make label in 1 line , input item in next line...
that will make a little issue .... we have many value needs designer to input into our UI table.
so , that will make UI table very long....
What /how can I do for the coding ?
dialog.windowTitle = "UnitDIE design (for Dialog) 2023-06-20"
formlayout = RBA::QVBoxLayout::new(dialog)
dialog.setLayout(formlayout)
label = RBA::QLabel.new(dialog)
formlayout.addWidget(label)
label.text = "Input PSV type...."
pm_type = RBA::QComboBox.new(dialog)
pm_type.addItem("PI")
pm_type.addItem("PBO")
formlayout.addWidget(pm_type)
by the way , may I shown a picture (*.gif or *.jpeg) into UI input table?
Comments
Better to use Qt Designer for a complicated UI design.

See the "Designer Dialog Sample" of the Macro editor on how to import a *.ui file designed by Qt Designer.
I mimicked your desired UI design: "ReUBM.[ui|qrc|rcc]" in the attached ZIP file.

Regarding images, you can refer to https://www.klayout.de/forum/discussion/636/images-in-qdialog
Generate a binary resource file *.rcc using Qt's resource compiler.
Then register it in the Ruby script.
In the macro editor...


The image is nothing but the label of the big button.
Hi sir,
Thanks a lot for your code , but Unlucky , I am not expert for Ruby.
I just want to base on Klayout Ruby DRC to make a UI for user to let they input some value.
I will check what your recommend , maybe I need to research more data for that.
Thanks again.
@kazzz I did not know that you can register resources that way! Many thanks for this document!
Matthias
Hi jiunnweiyeh
seems like you are trying to create a DRC UI and requires a lot of repeated components that is tedious to define one-by-one.
here's an example of wraping a group custom component in to a reusable CustomListItem object, which might able to reduce the work.
please check the last 10 lines of code, which use predefined custom widget to create the input form
Hi jiunnweiyeh
incase you need to embed a image into your widget without any external path dependency, you can try to convert the image in to a base64 string and paste it into your code.
here's an example of how to embed image into your program:
and here's how you convert a image into base64 string:
1. goto this site : https://www.base64-image.de/
2. drag and drop image into window for upload and conversion
3. after upload completed, click show code
4. copy every thing that is after
data:image/png;base64,
and paste to your codeHi Rawr,
got it , I will try it
(actually , I can make some simple code , look like that will over my current capbility..)
any way , Thanks for your help , I will try my best .
Hi jiunnweiyeh
I think i made the example abundantly long, the basic idea is to create a customWidget and make it reusable.
following code is a bare minimum example of creates a OptionSelectWidget class that inherts QWidget
in initalize function you define the ui components and place them into layout as usual
which it will be called once the widget is being created
this init function can take values such as title and list of options for later use.
rest of the part i ust copy from your exampl and replace them with custom widgets

Hi Rawr ,
Thanks for your help , I will try to make it into my current code.
Thanks.