Tk How Do You Feel Download

broken image


Whether you're a sports fanatic, a pet enthusiast, or just looking for a laugh, there's something for everyone on TikTok. All you have to do is watch, engage with what you like, skip what you don't, and you'll find an endless stream of short videos that feel personalized just for you. Tsakani 'TK' Mhinga (23 November 1978 – 27 February 2006) was a multiple SAMA award winning South African R&B singer, arranger and songwriter. In her lifetime she unquestionably occupied South Africa's R&B throne and was one of the country's prominent vocalists. She was found dead in a hotel room in Bryanston, Johannesburg by hotel staff on 27 February 2006, of what seemed to be either a.

Learn the Perl/Tk module, Part 1

Downloading

Content series:

This content is part # of # in the series: Learn the Perl/Tk module, Part 1

How do you feel when the food you order is served after a long wait? Or when there's a big line behind the checkout counter in the supermarket? You simply hate it. Guess what, your viewers don't like it any better when your site loads slowly. Worse for you, they show their displeasure by giving your site fewer visits and sales. Steps to Create an Entry Box using Tkinter Step 1: Create the Canvas. The Canvas is your display where you can place items, such as entry boxes, buttons, charts and more. You can control the dimensions of your Canvas by changing the width and height values. Day trip to your heart (and wallet's) content. It can be tough to swing a full weekend that involves air travel and well-kept hotels. But even just a trip to a town close by that you've.

https://www.ibm.com/developerworks/library/?series_title_by=learn+the+perl/tk+module

This content is part of the series:Learn the Perl/Tk module, Part 1

Stay tuned for additional content in this series.

The Perl language is usually used by IBM® AIX® operating system administrators and developers, and it can be found on nearly every successful Web site and most AIX systems. Although Perl scripts are powerful, they produce a Web interface that lacks a graphical front end, and the user has to type information instead of using the mouse, which can be an unsatisfying experience for the customer. This problem has been resolved with the introduction to the Tk module in Perl. An administrator or developer can quickly breathe new life into their Perl script with the Tk module and satisfy their customer's desire for an X11 product.

What is Perl?

Perl, or Practical Extraction and Reporting Languages, was created by Larry Wall in 1987 as a means to simplify his programming work. Since its conception, Perl has evolved into a globally used language and is a staple for most administrators and developers.

What is the Perl/Tk module?

The Perl/Tk module, also known as pTk or ptk, is a Perl module designed to create widgets and other commonly used graphical objects to form a graphical user interface (GUI). Using the module to create a GUI enhances the look and feel of a program and helps the end user navigate through the program and its functions. One major advantage of using the Perl/Tk module is that the resulting application can be cross-platform, meaning the same GUI application can be used on UNIX®, Linux®, Macintosh, Microsoft® Windows®, or any other operating system that has Perl and the Perl/Tk module installed.

Where to get the Perl/Tk module

Before you write an application with the Perl/Tk module, you must verify that Perl and the Perl/Tk module are installed. Although Perl is commonly installed on computers, the Perl/Tk module isn't. One way to verify if Perl is installed is to type perl --version at the command line. If Perl isn't installed, please refer to the installation guide found on Perl's Web site (see Related topics).

Once you've located or installed Perl on your computer, the next step is to determine whether the Perl/Tk module needs to be installed. A simple way to verify if a module is installed is to type perl -e 'use module' at the command prompt. To verify if the Perl/Tk module is installed, execute the following command:

If the module is found, the command executes and returns to a command prompt. However, if the module isn't found, an error message similar to the following is displayed:

Tk How Do You Feel Downloaded

Keep in mind that Perl is case sensitive: perl –e 'use Tk' and perl –e 'use tk' are two different statements trying to use two different modules (Tk and tk).

If the module isn't found, the next step is to download and install it. You can do so a couple of ways.

If you're using UNIX or Linux, one way to download and install Perl modules is to use the Comprehensive Perl Archive Network (CPAN). Type the following at the command prompt:

If you're using Windows, a similar approach is to use Perl Package Manager (PPM). At a command prompt, type ppm to start the GUI and download the Tk module.

Once the installation is complete, reverify that Perl can find the module by executing perl –e 'use Tk'.

Create a window

Now that the computer has Perl and the Perl/Tk module installed, it's time to write your first GUI program through the module. You'll start with a simple Hello World program. With your preferred text editor, create a file named helloworld.pl, and enter the following text in the file:

Executing this script generates the GUI application, as shown in Figure 1 below.

Figure 1. Hello World example

Let's break this script down, line by line:

The first part (/usr/bin/perl) defines the location where the Perl executable resides on the computer and instructs the computer to use this copy of the Perl executable to execute the helloworld.pl file. The second part of this line (-w) is a valuable tool in Perl: It enables warnings when executing the script, informing the end user of any possible errors found.

Comments and text that shouldn't be evaluated at execution are preceded with an octothorpe or # symbol:

In order for a Perl script to use the Tk module, it must be included—in other words, use Tk. Adding the use strict statement to a Perl script also helps find any possible typos or logic errors:

To create the primary window of the application, use MainWindow and assign it to $mw. $mw acts as the parent to all other widgets:

Set the main window size to 200 x 100 and title the window 'Hello World!!!:'

Create a label inside the main window with the caption Hello World. At the end of the label creation is an additional function, pack, which is the geometry manager. It's used on widgets to calculate the space allocated on the widget's parent; it also displays the widget:

This line creates a Close button inside the main window. When activated by a mouse click or executed by the keyboard, this button exits the Perl script:

Again, because this button takes up space on the main window, you need to use the pack function to calculate the space used.

Prior to executing MainLoop, everything in the script is read, defined, and prepared to execute. Then, when MainLoop is called, all functions and data read prior to that point are executed, and the GUI is displayed.

Widgets

This section introduces widgets. It covers a few basic widgets and presents examples of each, including frames, text, entry, buttons, and labels.

What is a widget?

A widget is a graphical object that performs a specific function. Any graphical object in the Perl/Tk module can be considered a widget. When you think of a GUI application, the buttons, text, frames, and scrollbars are all widgets.

The following widget examples build a base for widgets discussed later in this article.

Frame

The frame widget is exactly what it's named: a frame or box. The frame is used to group other widgets.

Enter the following script:

When you execute this script, it generates the GUI application, as shown in Figure 2.

Figure 2. Frame widget example

Let's break down the script:

This portion was discussed in the previous example, so let's move on to the new statements.

Create a frame with the main window as the parent, and set the background color to red. Unlike previous examples of the pack method, a few options are included:

The first argument, ipadx, increases the frame's width by 100 (50 x 2). The second argument, side, adjusts the geometric position of the frame to the left side of its parent ($mw). The third argument allocates space in the frame in the direction of y (vertically).

This frame is similar to the previous frame, but the background is blue, and the position is on the right side of the main window:

Text

The text widget creates an editable text workspace. Enter the following script:

Executing the script and typing in the window generates the GUI application, as shown in Figure 3.

Figure 3. Text widget example

Tk How Do You Feel Downloader

In this example, the text widget is created with the main window as the parent:

Rather than changing only the background color, the foreground font color is changed as well. As always, the pack method is used to allocate space and display the widget.

Entry

The entry widget is similar to the text widget in that you can edit or enter text in the widget. The text widget lets you enter multiple lines of text, and the entry widget allows only a single line of text.

Enter the following script:

Executing the script and typing in the window generates the GUI application, as shown in Figure 4.

Figure 4. Entry widget example

The only difference between the text widget and this one is the widget name:

However, as the example shows, you can supply only one line of text.

Button

The button widget creates a button that can execute functions or commands when activated by the end user. Nearly all graphical programs include buttons, so it's handy to be familiar with the button widget.

The following example uses three buttons. The first, labeled Button 1, displays the message Button 1 pushed with an OK button. The second button, labeled Button 2, displays the message Button 2 pushed with both Yes and No buttons asking whether the user wants to exit the program. Depending on which button is clicked, a new message is displayed stating that either the Yes or No button was clicked and the program does or doesn't exit.

Here's the example script:

Executing the script generates the GUI application, as shown in Figures 5 through 11.

Figure 5. Button widget example Figure 6. Button 1 clicked Figure 7. Button 2 clicked Figure 8. No button clicked Figure 9. Confirmation of No button clicked Figure 10. Yes button clicked Figure 11. Confirmation of Yes button clicked

This script is more complicated than the previous examples but, if you break it down, it's as easy to follow as the others. First, you create each button and assign the appropriate text to it (Button #1 or Button #2). Each button is linked to a command or function. The subroutines are appropriately called button1_sub and button2_sub:

When $button1 is clicked, the subroutine button1_sub is executed. Inside this function, a message box is created that displays the text Button 1 Pushed with a single button labeled OK. Because no further evaluations are performed on the OK button, the message box is destroyed and the main window regains focus.

This subroutine is similar to the first except that it includes two buttons labeled Yes and No. Once the user clicks a button, a new message box appears that states which one they clicked. Then, another message box is displayed that states whether the program is exiting:

Label

A label is a non-editable text widget. Labels can be useful prior to text boxes and entry boxes. Enter the following example script:

Executing this script generates the GUI application, as shown in Figure 12.

Figure 12. Label widget example

The first line creates the label with the text What's your name?:

To position the label to the left of the entry widget, you set pack to align to the left side. As in previous examples, an entry widget is created with a black background and white background. To position the entry to the right of the label widget, set pack to align to the right side.

Putting it all together

Now that you're familiar with a few widgets, let's put it all together in one script:

Executing this script generates the GUI application, as shown in Figure 13.

Figure 13. All-in-one example

Let's break it down like the other examples. First, you build a main frame and three frames inside it. These frames contain the other widgets and keep everything organized:

Next, you add the labels: one in the top frame and another in the left frame:

To accompany the label in the left frame, create an entry widget so that the user can type the text that they want copied. You also use a button widget to perform the copy function to copy the text to the right frame's text widget:

Now let's look at the right frame. A button widget lets the user clear all text from the text widget:

You also create a text widget so that the user can copy text from the entry widget and edit it if necessary.

These functions are the clear and copy subroutines:

The clear_entry function deletes all text starting from 0.0, or line 0 character 0, up to and including the end of the widget. The copy_entry function gets the text in the entry widget and inserts it into the text widget.

Conclusion

Introducing Perl with the Perl/Tk module into an AIX environment can benefit the developer, administrator, and customer or end user. You can enhance a script that might look dull to the customer into a professional-looking GUI application. It might take you a little while to get the hang of the widgets but, once you've mastered them, the results are worth the effort and time!

Tk How Do You Feel Downloading

Downloadable resources

Related topics

Tk How Do You Feel Download Google Chrome

  • Perl: You can download the latest version here.
  • ActivePerl: ActiveState offers a free and ready-to-install Perl distribution for Windows, Mac, OS X, Linux, Solaris, AIX, and HP-UX.
  • AIX and UNIX®: The AIX and UNIX developerWorks zone provides a wealth of information relating to all aspects of AIX systems administration and expanding your UNIX skills.
  • AIX Wikis: Discover a collaborative environment for technical information related to AIX.
  • Search the AIX and UNIX library by topic:
  • IBM® trial software: Build your next development project with software for download directly from developerWorks.




broken image