Zenity: Add shell to graphical interface

Source: Internet
Author: User

Sometimes you can write your own gadgets and prefer non-graphic interfaces. However, some applications still bring up a reminder to let you know.

Zenity is a very handsome thing. For its usage, refer to its -- help. I will not repeat it here. Here is my example:

 

 

This is a small stuff used to query user information in the blog Park.

MyCodeThe shell command called using Python has a graphical interface. In fact, pygtk is more handsome and learning ...... (The source code package failed to be uploaded, so I had to stick it here)

# ! /Usr/bin/Python
# -*-Coding: UTF-8 -*-
# Filenam: get_cnblogs.py
# Author z_zz
Import OS
Import Sys
Import Re
From Urllib Import Urlopen
String = Urlopen ( " Http://www.cnblogs.com/AllBloggers.aspx " ). Read ()
Usr_name =   ' Amboyna '
URL =   " Http://www.cnblogs.com "

Usr_length=Len (usr_name)
I=String. Count (usr_name)
R=String. Find (usr_name)
Usr_string=String [R- 60: R+ 50]

Name_s = Usr_string.find (usr_name +   " /\ " > " ) + Len (usr_name) + 3
Name_e = Usr_string.find ( " </A> & nbsp; " )
Name = Usr_string [name_s: name_e]

small_s = usr_string.find ( ' ' )
small_e = usr_string.find ( ' . & nbsp; ' )
NO = usr_string [small_s + 7 : small_e]

Http_s=Usr_string.find (URL)
HTTP=Usr_string [http_s: http_s+Len (URL)+Usr_length+ 1]

# --------------------------------------------------
# Print '\ N'
# Print '----------------------------------'
# Print 'id: \ t', usr_name
# Print 'name: \ t', name
# Print 'No.: \ t', no
# Print 'url: \ t', HTTP
# Print '---------------------------------- \ N'
# --------------------------------------------------

Str = " Your blog information: \ n ============================================ =====\ n "
Str + =   " ID: \ t "   + Usr_name
Str + =   " \ Nname: \ t "   + Name
Str + =   " \ N no.: \ t "   + No
Str + =   " \ N URL: \ t "   + HTTP
Str + =   " \ N ============================================ =====\ n "
Str + =   " \ N \ t \ tby amboyna \ n "
Print Str
OS. System ( ' Zenity -- info -- Title = \ ' Www. cnblogs. com \ ' -- Text = \ '' + STR + ' \ '' )

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.