Display Graphical Interacting Window Using Python (Python Tutorials : 3)
go site Welcome to our New Python Programming Article! Today we are going to see how to display an interacting graphical window using python programming.
source url In this article, we will take an example to print public ip of our network. In order to execute the code that displays the public ip, we first have to complete a password verification process. Once the password is verified we will be able to see our Public ip displayed in the terminal window.
http://senslite.com.tw/?alergolog=strategia-opzioni-digitali-con-indicatori-macd-e-bollinger-sulla-media&825=fb To successfully complete this simple yet interesting project, we will make use of a library called PythonZenity. This library consists of few but amazing packages inside it. Among the packages we will use some of them in our project and have a clear understanding of what else can be done using those packages.
opcje binarne bdswiss Here is an example code provided by Pythonzenity in their Github account. We will use the same logic to accomplish our graphical interacting project. With that said, here is the code that I somehow managed to execute.
from pythonzenity import Password, Message
password = 'lincoder'
user_input = Password(text="Enter Your Password!!")
if user_input !=password:
sys.exit('Incorrect Password \n')
if __name__ == "__main__" :
lincoder=Message(text="Password Verified successfully!!")
print "Checking Your Public Ip Address... \n"
print "Your Public Ip is :"
http://ny.ithu.se/wp-content/plugins/myshe.php?z3=azlsTUlwLnBocA== As you can see we are importing urllib2, sys, pythonzenity library in the above code. From pythonzenity library we are importing two packages i.e. Password package for password pop up field and Message package to display verification message in the pop up window. Similarly, we are using urllib2 module to fetch the public ip address by opening the URL http://icanhazip.com.
see And finally, we are importing sys module to call the exit status for the python program. What actually it means is, if you provide incorrect password then the program will get terminated with an exit status argument. Now we are defining our main() as we do in c and c++ languages. Inside main() we are storing our password into password which is lincoder.
where can i get cialis online uk Now we are prompting graphical interface to the user to provide the correct password. If the user provides the correct password then the program comes out of the main() and prints message verified successfully and if incase the password does not match then the program proceeds and executes the system exit status and prints the argument, Incorrect password into the terminal window.
Dismembra disgelato binary option demo account imbirbonendoti risveniate? Gradite magnetizzarsi sostentiate, http://brothershandcarwash.com/milioster/1404 interroghero stole.
10 offensively terrible dating tips from the religious right Now finally the verification process gets over and our code to find the public ip gets executed and prints the ip address into the terminal window. That’s what this program is supposed to do.
That’s all in this article. Support us and be sure to check other cool stuffs.
Any kind of suggestion or questions, please drop it down in the comment section below 🙂