[Scilab-users] Using uimenue to change rotation_angles

Jens Simon Strom j.s.strom at hslmg.de
Sun Dec 18 18:04:45 CET 2016


Hi Samuel,
what I really do is this:

xdel()
figure_size=[1800 900];
cf=figure(1,'position',[0 0 figure_size],'background',8,'immediate_drawing','off','visible','off');
//...
//plot3d and param3d commands
// ...
Rotation_Angles=[85 -64];
ca=gca();
ca.box='off';
xtitle('$\Huge{\text{Isometrisch}}$','','')
cf.immediate_drawing='on'; cf.visible='on';
  
m1= uimenu(cf,'label','Himmelspol','callback','ra=[0,0],xtitle(''$\Huge{\text{Himmelspol}}$'','','')');
m2= uimenu(cf,'label','Ost','callback','ra=[90,90],xtitle(''$\Huge{\text{Ost}}$'','','')');
m3= uimenu(cf,'label','Äquator','callback','ra=[90,0],xtitle(''$\Huge{\text{Äquator}}$'','','')');
m4= uimenu(cf,'label','West','callback','ra=[90,-90],xtitle(''$\Huge{\text{West}}$'','','')');
m5= uimenu(cf,'label','Isometrisch','callback','ra=Rotation_Angles,xtitle(''$\Huge{\text{Isometrisch}}$'','','')');
m6= uimenu(cf,'label','Animation','callback','Case=1,xtitle(''$\Huge{\text{Rotierend}}$'','','')');
m7= uimenu(cf,'label', 'Aus', 'callback', "t=%f");

Case=0;//Initiierung für Anfangspassage, d.h.keine Animation
ra=Rotation_Angles;//Initiierung für Anfangspassage
t=%t;
while t==%t
   if Case==1//m6
       Case=0;
       rota=ca.rotation_angles;
       for k=[0:1:90 89:-1:0]
          drawlater()
          ca.rotation_angles=rota+[0 k];
          sleep(10);
          drawnow()
       end//for k=[ .... ]
   else
        sleep(200)
        ca.rotation_angles=ra;
   end//if
end//while


This works satisfactorily. I could not get the result without the 
infinite loop.

Kind regards
Jens
-----------------------------------------------------------------------


Am 18.12.2016 16:36, schrieb Samuel Gougeon:
> Le 18/12/2016 16:20, Jens Simon Strom a écrit :
>> Hi Samuel,
>> Without the loop the script finishes and gives no chance to change 
>> anything.
> ?
> Have you tried? Since the figure and its menus are still here, you can 
> still use them, even if the script having generating them is finished.
>
> A callback is an asynchronous independent script that is performed 
> just when it is called, "at any time" (actually, its instructions are 
> queued when it is called, and performed ASAP).
>
> You don't need to block the console with a loop to make changes or 
> actions on existing graphics.
> But if you want to make it "modal", that is to say waiting for and 
> compelling the user to do something, yes, a loop is required.
> BTW, the loop that you use is infinite: there is no way to escape it 
> smoothly, since
> while 1
> is always true.
>
> SG
>
>
>
> _______________________________________________
> users mailing list
> users at lists.scilab.org
> http://lists.scilab.org/mailman/listinfo/users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20161218/8d380651/attachment.htm>


More information about the users mailing list