Create a MessageBox in Python


To show a message box using Tkinter, you can use messagebox library like this:
  1. from tkinter import messagebox
  2. showinfo('Message title' , 'Message content')
Pretty easy!!
Let’s show a message box when the user clicks a button.

 The output of the above code is shown below:

And when you will press the created button, a messagebox will appear on the screen as shown below:


ABOUT:
The programming language you will learn is Python. Python is an example of a highlevel language; other high-level languages you might have heard of are C, C++, Perl, and Java.
There are also low-level languages, sometimes referred to as “machine languages” or “assembly languages.” Loosely speaking, computers can only run programs written in low-level languages. So programs written in a high-level language have to be processed before they can run. This extra processing takes some time, which is a small disadvantage of high-level languages.

The advantages are enormous. First, it is much easier to program in a high-level language. Programs written in a high-level language take less time to write, they are shorter and easier to read, and they are more likely to be correct. Second, high-level languages are portable, meaning that they can run on different kinds of computers with few or no modifications. Low-level programs can run on only one kind of computer and have to be rewritten to run on another.
Due to these advantages, almost all programs are written in high-level languages. Lowlevel languages are used only for a few specialized applications.
Two kinds of programs process high-level languages into low-level languages: interpreters and compilers. An interpreter reads a high-level program and executes it, meaning that it does what the program says. It processes the program a little at a time, alternately reading lines and performing computations.

Python is a general purpose programming language created in the late 1980s, and named after Monty Python, that’s used by thousands of people to do things from testing microchips at Intel, to powering Instagram, to building video games with the PyGame library. It’s small, very closely resembles the English language, and has hundreds of existing third-party libraries.
So what are the major reasons why I, personally, choose Python and recommend it to as many people as possible? It comes down to three reasons.
Readability:
Python very closely resembles the English language, using words like ‘not’ and ‘in’ to make it to where you can very often read a program, or script, aloud to someone else and not feel like you’re speaking some arcane language. This is also helped by Python’s very strict punctuation rules which means you don’t have curly braces ({ }) all over your code.
Also, Python has a set of rules, known as PEP 8, that tell every Python developer how to format their code. This means you always know where to put new lines and, more importantly, that pretty much every other Python script you pick up, whether it was written by a novice or a seasoned professional, will look very similar and be just as easy to read. The fact that my Python code, with five or so years of experience, looks very similar to the code that Guido van Rossum (the creator of Python) writes is such an ego boost.

Comments

  1. IAS Coaching in DELH

    i love your bloge and It's very help full for me

    ias cooaching

    ReplyDelete

Post a Comment