[Scilab-users] Help write simple GUI

Claus Futtrup cfuttrup at gmail.com
Sat May 31 22:01:01 CEST 2014


Hi there

I hope someone can help me make a simple GUI front end to my script, 
preferably without using GUI Builder or guimaker, because I think I'll 
understand better without using additional tools.

The GUI - a window containing two variable input:
1. text + input box + text
    Again the input is a number, typically an integer (as in "system 
power : 100 Watt"). 100 being the user variable input.
2. text + input box + text
    A number, typically an intereger (as in "impedance : 8 ohm"). 8 
being the user variable input.

The script will then based on 100 Watt into 8 ohm calculate the voltage 
= sqrt(100*8). I will round the number to one decimal, convert it to a 
string and create an answer, like "Input level : 28.3 Volt".

The GUI should contain two buttons, e.g. an OK + a QUIT button. The OK 
button runs the calculations. The quit button quits the script (may as 
well quit Scilab).

I've studied the GUI controls in Scilab already and I understand the the 
old way of making a new window is:

f = figure();

but it seems there's a new command in Scilab 5.5.0:

f = createWindow();

The new method probably has its advantages, but the Scilab manual 
doesn't really explain... can anybody explain to me?

Can you use the same uicontrol commands with both methods? (can I use 
examples found on the internet using "figure" and just replace figure 
with createWindow?). It seems to me that the examples in the 
createWindow gives uicontrol some inputs named "units" - "normalized" - 
etc. - which are not present when looking at old figure() examples.

My next question will be, how do I create a uicontrol which accepts a 
string input (as I need 2 of those). The uicontrol documentation says 
the "Edit" style will do that. Funny, but also a bit strange, that you 
can find all sorts of examples for using uicontrol with checboxes, 
listboxes, radiobuttons, pushbuttons, tables etc. - but no examples are 
provided with this most useful editable string input ... (???)

... hereafter I expect to evaluate the two strings (or if they're 
returned as numbers, that's fine of course, I just don't need the script 
to crash if something is not right). Then execute my code.

Best regards,
Claus

---
This email is free from viruses and malware because avast! Antivirus protection is active.
http://www.avast.com




More information about the users mailing list