D – Basic Output

In this tutorial, I will be introducing you to a language called D. We will be creating a simple program that outputs “Hello World” on the screen.

First, you should download D here: http://dlang.org/download.html

 

Then, install the software. Installation is very easy because all you need to do is read and follow the directions.

 

After installation, create a new folder in My Documents named tutorials.

While inside the tutorials folder, create a new text document and rename it output.d.

Open the file with your favorite text editor (I love to use Notepad++).

Type the codes same as below:

d1

 

 

Open your command prompt.

Next, change your directory using the cd command.

type dmd then the name of your file

type the name of the exe file that was generated.

our output should be the same as below:

 

d2

 

 

Thank you for reading this post.

Don’t forget to leave a comment.

Python – GUI (Grid Layout)

In this tutorial, I will be demonstrating Graphical User Interface
Programming using Python.

The codes are below:

 

gui2

 

 

Our output should be the same as below:

 

gui1

 

 

Explanation:

 

These lines:

Label(master, text=”Name:”).grid(row=0)
Label(master, text=”Age:”).grid(row=1)

– one way of declaring one or more labels and giving them their position in the grid

While these lines:

E1 = Entry(master)
E2 = Entry(master)

E1.grid(row=0, column=1)
E2.grid(row=1, column=1)

-another way of declaring one or more textboxes then giving their position in separate lines.

 

Thank you for reading this post.

Don’t forget to leave a comment or suggestion. 🙂

Python – GUI (Label and Textbox)

In this tutorial, I will be demonstrating Graphical User Interface
Programming using Python.

The codes are below:

gui1

 

Our output should be the same as below:

gui2

 

 

Explanation:

 

The lines:

top = Tk()

top.mainloop()

– are used to initialize the form

 

The lines:

L1 = Label(top, text=”First Name”)

L1.pack( side = LEFT)

-used to initialize and position the Label to the left with a caption of First Name

 

The lines:

E1 = Entry(top, bd =5)

E1.pack(side = RIGHT)

-used to initialize and position the text box to the right.

 

Thank you very much for reading this post.

Don’t forget to leave a comment or suggestion. 🙂

Python – GUI (Button)

In this tutorial, I will be demonstrating Graphical User Interface
Programming using Python.

The codes are below:

gui1

 

Our output should be the same as below:

gui2

gui3

 

There are several points needed to be explained here.
The import keyword on the first two lines are used to use the libraries native to Python.
Tkinter and tkMessageBox are used for basic GUI Programming.

The lines:

top = Tkinter.Tk()
B.pack()
top.mainloop()

are used to initialize the main form of the program

On this part:

def helloCallBack():
tkMessageBox.showinfo(“Hello Python”, “Hello World”)

  • the def keyword is the same as the function block in other languages
  • the showinfo has two parameters which are:
    “Hello Python” is the used as the title of the Message Box
    “Hello World” is the message inside the Message Box

The line:

B = Tkinter.Button(top, text =”Hello”, command = helloCallBack)

is the initialization of the Button which contains three parameters
top is the position of the button inside the box
text is the String that is used to name the button
command points to function where the button goes when it is clicked

 

Thank you for reading my post.
Don’t forget to leave a comment.