পৃষ্ঠাসমূহ

Search Your Article

CS

 

Welcome to GoogleDG – your one-stop destination for free learning resources, guides, and digital tools.

At GoogleDG, we believe that knowledge should be accessible to everyone. Our mission is to provide readers with valuable ebooks, tutorials, and tech-related content that makes learning easier, faster, and more enjoyable.

What We Offer:

  • 📘 Free & Helpful Ebooks – covering education, technology, self-development, and more.

  • 💻 Step-by-Step Tutorials – practical guides on digital tools, apps, and software.

  • 🌐 Tech Updates & Tips – simplified information to keep you informed in the fast-changing digital world.

  • 🎯 Learning Support – resources designed to support students, professionals, and lifelong learners.

    Latest world News 

     

Our Vision

To create a digital knowledge hub where anyone, from beginners to advanced learners, can find trustworthy resources and grow their skills.

Why Choose Us?

✔ Simple explanations of complex topics
✔ 100% free access to resources
✔ Regularly updated content
✔ A community that values knowledge sharing

We are continuously working to expand our content library and provide readers with the most useful and relevant digital learning materials.

📩 If you’d like to connect, share feedback, or suggest topics, feel free to reach us through the Contact page.

Pageviews

Tuesday, April 4, 2017

Tk - Environment

Generally, all Mac and Linux mac come with Tk pre-installed. In case, it's not available or you need the latest version, then you may need to install it. Windows don't come with Tcl/Tk and you may need to use its specific binary to install it.

The Tk Interpreter

It is just a small program that enables you to type Tk commands and have them executed line by line. It stops execution of a tcl file in case, it encounters an error unlike a compiler that executes fully.
Let's have a helloWorld.tcl file as follows. We will use this as first program, we run on the platform you choose.
#!/usr/bin/wish

grid [ttk::button .mybutton -text "Hello World"] 
The following section explains only how to install Tcl/Tk on each of the available platforms.

Installation on Windows

Download the latest version for windows installer from the list of Active Tcl/Tk binaries available. Active Tcl/Tk community edition is free for personal use.
Run the downloaded executable to install the Tcl and Tk, which can be done by following the on screen instructions.
Now, we can build and run a Tcl file say helloWorld.tcl by switching to folder containing the file using cd and then using the following step −
C:\Tcl> wish helloWorld.tcl
Press enter and we will see an output as shown below −
Hello World Windows

Installation on Linux

Most Linux operating systems comes with Tk inbuilt and you can get started right away in those systems. In case, it's not available, you can use the following command to download and install Tcl-Tk.
$ yum install tcl tk
Now, we can build and run a Tcl file say helloWorld.tcl by switching to folder containing the file using cd command and then using the following step −
$ wish helloWorld.tcl
Press enter and we will see an output similar to the following −
Hello World

Installation on Debian Based Systems

In case, it's not available prebuilt in your OS, you can use the following command to download and install Tcl-Tk −
$ sudo apt-get install tcl tk
Now, we can build and run a Tcl file say helloWorld.tcl by switching to folder containing the file using cd command and then using the following steps −
$ wish helloWorld.tcl
Press enter and we will see an output similar to the following −
Hello World

Installation on Mac OS X

Download the latest version for Mac OS X package from the list of Active Tcl/Tk binaries available. Active Tcl community edition is free for personal use.
Run the downloaded executable to install the Active Tcl, which can be done by following the on screen instructions.
Now, we can build and run a Tcl file say helloWorld.tcl by switching to folder containing the file using cd command and then using the following step −
$ wish helloWorld.tcl
Press enter and we will see an output as shown below −
Hello World

Installation from Source Files

You can use the option of installing from source files when a binary package is not available. It is generally preferred to use Tk binaries for Windows and Mac OS X, so only compilation of sources on unix based system is shown below −
  • Download the source files.
  • Now, use the following commands to extract, compile and build after switching to the downloaded folder.
$ tar zxf tk8.6.1-src.tar.gz
$ cd tcl8.6.1
$ cd unix
$ ./configure with-tcl=../../tcl8.6.1/unix prefix=/opt enable-gcc
$ make
$ sudo make install
Note − Make sure, you change the file name to the version you downloaded on commands 1 and 2 in the above.

No comments:

Post a Comment