Closing of a

Altair Forum User
Altair Forum User
Altair Employee
edited October 2020 in Community Q&A

Hey guys,

 

I created a .tcl-script which opens a window where I can put in a reference temperature. After the value is entered, I would like the window to be closed automatically and hence to exit the program.

I can't find any commands (like an exit-command) that work the way I want them to. Can you help me out on this topic?

 

Kind regards,

Simon

 

Attached you can find the script:

Unable to find an attachment - read this blog

Answers

  • llyle_20499
    llyle_20499 New Altair Community Member
    edited November 2018

    Hi,

     

    In your code,

     

     destroy .window11

     

    will close the window. Not sure how to close it as soon as you enter a value. 

  • tinh
    tinh Altair Community Member
    edited October 2020
  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited November 2018

    Hey guys,

    thank you both for your quick replies.

     

    There's still a problem left. After entering the value for the first time and closing the window, I open the same window again by clicking on my button. The value I entered the first time seems to be stored somehow, because it's still appearing on the screen.

    Do you know how I can delete the value and clear the window?

     

    Kind regards,

    Simon

  • tinh
    tinh Altair Community Member
    edited November 2018

    If you use an entry widget, clear its content by

    $e delete 0 end

     

    Or set value of its text variable as ''

  • llyle_20499
    llyle_20499 New Altair Community Member
    edited November 2018

    In current program you can use

     

     catch {unset ref_temp} 

     

    in the beginning.