Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8336901
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T04:08:01+00:00 2026-06-09T04:08:01+00:00

Still new to this and I’ve created an interesting problem for myself that I

  • 0

Still new to this and I’ve created an interesting problem for myself that I can’t solve…

I am trying to design my own “pop-up” box that allows the user to edit an existing string. It is popped up when a button is pressed, displaying the string in an entry box. Once the user has edited the string (or not), he hits the “OK” button and it goes away and the script should now have the new string.

My approach is something like this:

On button press, create a toplevel window with three widgets:

  • simple label “Edit string, press ok when done”;
  • editable entry containing the predefined string;
  • button “OK” that destroys the toplevel window when pressed.

I have sort of got that working but can’t figure out how to get the edited string.

I realize my fundamental problem is I am not thinking in “event-driven” terms. It seems like this should be easily doable but but I can’t see the forest at this point.

What am I missing? Am I over complicating this?

#!/usr/bin/wish

# Create the Pop-up box
proc popUpEntry { labelString } {
  global myString

  puts "POP:myString = $myString"

  set top [toplevel .top]
  set labelPop [label $top.labelPop -text $labelString ]
  set entryPop [entry $top.entryPop -bg white -width 20 -textvar $myString ]
  set buttonPop [button $top.buttonPop -text "Ok" -command { destroy .top } ]

  pack $labelPop
  pack $entryPop
  pack $buttonPop
}

# Pop-up command
proc DoPop {} {
  global myString

  set popUpLabel "Edit string, press ok when done:"
  puts "Before: myString = $myString"  
  popUpEntry $popUpLabel
  puts "After: myString = $myString"
}

# Initalize
set myString "String at start"

# Pop-up button invokes the pop-up command
set buttonPop [button .buttonPop -width 10 -text "Pop" -command {DoPop} ]
pack $buttonPop

#
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T04:08:03+00:00Added an answer on June 9, 2026 at 4:08 am

    In this line:

    set entryPop [entry $top.entryPop -bg white -width 20 -textvar $myString ]
    

    you are setting the entry control’s -textvar to the contents of the variable myString.

    You should set it to be the variable itself by removing the $ symbol:

    set entryPop [entry $top.entryPop -bg white -width 20 -textvar myString ]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im still new to this android stuff but I am trying to write a
I'm still pretty new to this, but I'm trying to make a calculator for
I'm still new at this, so bear with me: I created a new Window-based
Still new at this ... Sorry! I have a template for multiple pages that
i am still new to the Java language and libraries... i often use this
I am still new to the storyboard stuff. I spent two days debugging this
So, I'm still new with the php coding, still learning, etc. So, if this
Im still pretty new so bear with me on this one, my question(s) are
I'm still fairly new to Java, but I'm fairly sure this shouldn't happen. There's
Okay this is my 4th question today on Scheme, still pretty new to Scheme,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.