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 1075647
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T21:18:06+00:00 2026-05-16T21:18:06+00:00

I want to create a simple Console in Tcl/Tk I have two problems. First

  • 0

I want to create a simple Console in Tcl/Tk

I have two problems. First changing every * with a [glob *] but also, when my entry contains “ls -a” it doesn’t understand that ls is the command and -a the first arg.

How can I manage to do that ?

Thanks

proc execute {} {
    # ajoute le contenu de .add_frame.add_entry
    set value [.add_frame.add_entry get]
    if {[string compare "$value" ""] == 1} {
    .text insert end "\n\n% $value\n"
        .text insert end [exec $value]
    .add_frame.add_entry delete 0 end
    }
}

frame .add_frame

label .add_frame.add_label -text "Nouvel élément : "
entry .add_frame.add_entry
button .add_frame.add_button -text "Executer" -command execute
button .add_frame.exit_button -text "Quitter" -command exit

bind  .add_frame.add_entry  <Return> execute
bind  .add_frame.add_entry  <KP_Enter> execute
bind  .  <Escape> exit
bind  .  <Control-q> exit

pack .add_frame.add_label -side left
pack .add_frame.exit_button -side right
pack .add_frame.add_button -side right
pack .add_frame.add_entry -fill x -expand true

pack .add_frame -side top -fill x

text .text
.text insert end  "% Tcl/Tk Console"

pack .text -side bottom -fill both -expand true
  • 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-05-16T21:18:07+00:00Added an answer on May 16, 2026 at 9:18 pm

    The simple answer in Tcl 8.5 is to use this:

    exec {*}$value
    

    In 8.4 and before, that syntax didn’t exist. That meant that many people wrote this:

    eval exec $value
    

    But in reality, the safe version was one of these:

    eval exec [lrange $value 0 end]
    eval [linsert $value 0 exec]
    

    Of course, if the $value is coming straight from the user then you’re better off using a system shell to evaluate it since more users expect that sort of syntax:

    exec /usr/bin/bash -c $value
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have installed visual studio 2008 and i want to create some simple applications
I want to create a simple http proxy server that does some very basic
I want to create a simple box with a header bar containing a title
I want to create a simple bit of JS code that creates an image
I want to create a very simple HTML/AJAX based GUI for a Python program.
Let's say that you want to create a dead simple BlogEditor and, one of
I'm making a simple form to create polls, therefore I want the possibility to
I have a simple GtkStatusBar created with glade,and want to add a simple message
I have started out to write a simple console Yahtzee game for practice. I
I'm playing around with Qt , and I want to create a simple pause

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.