import antigravity
That will open your browser with one comics from xkcd website.
The antigravity module was added to Python 3.5.1. I'm not sure but seam working also with python 2.7 version.
Is a blog about python programming language. You can see my work with python programming language, tutorials and news.
import antigravity
class Win32_Process : CIM_Process
{
string Caption;
string CommandLine;
string CreationClassName;
datetime CreationDate;
string CSCreationClassName;
string CSName;
string Description;
string ExecutablePath;
uint16 ExecutionState;
string Handle;
uint32 HandleCount;
datetime InstallDate;
uint64 KernelModeTime;
uint32 MaximumWorkingSetSize;
uint32 MinimumWorkingSetSize;
string Name;
string OSCreationClassName;
string OSName;
uint64 OtherOperationCount;
uint64 OtherTransferCount;
uint32 PageFaults;
uint32 PageFileUsage;
uint32 ParentProcessId;
uint32 PeakPageFileUsage;
uint64 PeakVirtualSize;
uint32 PeakWorkingSetSize;
uint32 Priority = NULL;
uint64 PrivatePageCount;
uint32 ProcessId;
uint32 QuotaNonPagedPoolUsage;
uint32 QuotaPagedPoolUsage;
uint32 QuotaPeakNonPagedPoolUsage;
uint32 QuotaPeakPagedPoolUsage;
uint64 ReadOperationCount;
uint64 ReadTransferCount;
uint32 SessionId;
string Status;
datetime TerminationDate;
uint32 ThreadCount;
uint64 UserModeTime;
uint64 VirtualSize;
string WindowsVersion;
uint64 WorkingSetSize;
uint64 WriteOperationCount;
uint64 WriteTransferCount;
};
Let's make one simple example with wmi python module.import wmi
c = wmi.WMI()
for process in c.Win32_Process ():
name = process.Properties_("Name").Value
pid = process.Properties_('ProcessID').Value
parent = process.Properties_('ParentProcessId')
termination = process.Properties_('TerminationDate')
print (name,' = pid -',pid,'+', parent,'|termination_date-',termination)
And the output of this script it's :firefox.exe = pid - 13788 + 2564 |termination_date- None
explorer.exe = pid - 1048 + 772 |termination_date- None
sublime_text.exe = pid - 11404 + 2564 |termination_date- None
plugin_host.exe = pid - 7432 + 11404 |termination_date- None
cmd.exe = pid - 9568 + 2564 |termination_date- None
conhost.exe = pid - 14124 + 9568 |termination_date- None
conhost.exe = pid - 9700 + 11208 |termination_date- None
Taskmgr.exe = pid - 9424 + 13404 |termination_date- None
WmiPrvSE.exe = pid - 9764 + 772 |termination_date- None
SpfService64.exe = pid - 11908 + 684 |termination_date- None
python.exe = pid - 1308 + 9568 |termination_date- None
C:\Python34\Scripts>pip install wmi
...
Installing collected packages: wmi
Running setup.py install for wmi
warning: install_data: setup script did not provide a directory for 'readme.
txt' -- installing right in 'C:\Python34'
...
Successfully installed wmi
Cleaning up...
C:\Python34>python
Python 3.4.1 (v3.4.1:c0e311e010fc, May 18 2014, 10:45:13) [MSC v.1600 64 bit (AM
D64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import wmi
>>> remote_process = wmi.WMI (computer="home").new ("Win32_Process")
>>> for i in wmi.WMI ().Win32_OperatingSystem ():
... print (i.Caption)
...
Microsoft Windows 10 Home
import wmi
import datetime
c = wmi.WMI()
process_watcher = c.Win32_Process.watch_for("modification")
while True:
new_process = process_watcher()
print (new_process.Caption)
C:\Python34\Scripts>pip3.4.exe install svgwrite
Collecting svgwrite
Downloading svgwrite-1.1.6.tar.gz (109kB)
100% |################################| 110kB 354kB/s
Also this svgwrite is the only module that needs to be imported and then you can deal with this module.import svgwrite
from svgwrite import *
#this will work with svgwrite
svg_doc = svgwrite.Drawing(filename = "test-svgwrite.svg",\
size = ("30px", "30px"))\
svg_doc.add(svg_doc.rect(insert = (0, 0),\
size = ("20px", "20px"),\
stroke_width = "1",\
stroke = "green",\
fill = "rgb(255,255,0)"))\
print(svg_doc.tostring())
svg_doc.save()
The result of this python script is this SVG file.>>> dir(svgwrite)
['AUTHOR_EMAIL', 'AUTHOR_NAME', 'CYEAR', 'Drawing', 'Hz', 'Unit', 'VERSION', '__
builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__p
ackage__', '__path__', '__spec__', 'animate', 'base', 'cm', 'container', 'data',
'deg', 'drawing', 'elementfactory', 'em', 'etree', 'ex', 'filters', 'grad', 'gr
adients', 'image', 'inch', 'kHz', 'masking', 'mixins', 'mm', 'params', 'path', '
pattern', 'pc', 'percent', 'pt', 'px', 'rad', 'rgb', 'shapes', 'text', 'utils',
'validator2', 'version']
For example you can add some text:svg_doc.add(svg_document.text("This add new svg text",\
insert = (10, 10)))
C:\Python27>python.exe
Python 2.7.11rc1 (v2.7.11rc1:82dd9545bd93, Nov 21 2015, 23:25:27) [MSC v.1500 64
bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>
Also I got a list of all available modules...No handlers could be found for logger "OpenGL.Tk"
ImportError: numpy.core.multiarray failed to import
BaseHTTPServer audioop imaplib scrap
Bastion base imghdr select
BeautifulSoup base64 imp sets
BeautifulSoupTests bdb importlib setuptools
CGIHTTPServer binascii imputil sgmllib
Canvas binhex inspect sha
ConfigParser bisect io shellescape
Cookie bs4 itertools shelve
Dialog bsddb joystick shelve_test
DocXMLRPCServer bufferproxy json shlex
FileDialog bz2 key shutil
FixTk cPickle keyword signal
HTMLParser cProfile lib2to3 simplejson
MimeWriter cStringIO linecache site
Naked cached_property locale six
OpenGL calendar locals smtpd
PIL camera logging smtplib
PySide cdrom mac_scrap sndarray
Queue cgi macosx sndhdr
ScrolledText cgitb macpath socket
SimpleDialog chunk macurl2path sprite
SimpleHTTPServer cmath mailbox sqlite3
SimpleXMLRPCServer cmd mailcap sre
SocketServer code markupbase sre_compile
StringIO codecs marshal sre_constants
Tix codeop mask sre_parse
Tkconstants collections math ssl
Tkdnd color md5 stat
Tkinter colorama mhlib statvfs
UserDict colordict midi string
UserList colorsys mimetools stringold
UserString commands mimetypes stringprep
_LWPCookieJar compat mimify strop
_MozillaCookieJar compileall mixer struct
__builtin__ compiler mixer_music subprocess
__future__ constants mmap sunau
_abcoll contextlib modulefinder sunaudio
_arraysurfarray cookielib mouse surface
_ast copy movie surfarray
_bisect copy_reg msilib surflock
_bsddb crypto msvcrt symbol
_camera csv multifile symtable
_camera_opencv_highgui ctypes multiprocessing sys
_camera_vidcapture curses mutex sysconfig
_codecs cursors netrc sysfont
_codecs_cn cv new tabnanny
_codecs_hk cv2 newbuffer tarfile
_codecs_iso2022 datetime nmovie telnetlib
_codecs_jp dateutil nntplib tempfile
_codecs_kr dbhash nt test
_codecs_tw decimal ntpath test27
_collections decorator nturl2path test_crypto_python
_csv difflib numbers tests
_ctypes dircache numpy textwrap
_ctypes_test dis oauth2client this
_dummybackend display opcode thread
_elementtree distutils operator threading
_freetype docs optparse threads
_functools doctest os time
_hashlib draw os2emxpath timeit
_heapq dumbdbm overlay tkColorChooser
_hotshot dummy_thread parser tkCommonDialog
_io dummy_threading pdb tkFileDialog
_json easy_install pickle tkFont
_locale ecdsa pickletools tkMessageBox
_lsprof email pip tkSimpleDialog
_markerlib encodings pipes toaiff
_md5 ensurepip pixelarray token
_msi errno pixelcopy tokenize
_multibytecodec event pkg_resources trace
_multiprocessing examples pkgdata traceback
_numericsndarray exceptions pkgutil transform
_numericsurfarray extraction platform ttk
_numpysndarray fastevent plistlib tty
_numpysurfarray filecmp popen2 turtle
_osx_support fileinput poplib types
_pyio fnmatch posixfile unicodedata
_pytest font posixpath unittest
_random formatter pprint uritemplate
_sha fpformat profile url-scrap
_sha256 fractions pstats urllib
_sha512 freetype pty urllib2
_socket ftfont py urllib3
_sqlite3 ftplib py_compile urlparse
_sre functools pyasn1 urwid
_ssl future_builtins pyasn1_modules user
_strptime gc pyclbr uu
_struct genericpath pycuda uuid
_subprocess get-pip pydoc version
_symtable getopt pydoc_data vidcap
_testcapi getpass pyexpat virtualenv
_threading_local gettext pygame virtualenv_support
_tkinter gfxdraw pypm warnings
_vlcbackend glob pysideuic wave
_warnings googleapiclient pytest weakref
_weakref gp2x pytools webbrowser
_weakrefset gzip pytz wheel
_winreg hashlib quopri whichdb
abc heapq random winsound
aifc hmac re wsgiref
antigravity hotshot rect xdrlib
anydbm html5lib repr xlsxwriter
apiclient htmlentitydefs requests xml
appdirs htmllib rexec xmllib
argparse httplib rfc822 xmlrpclib
array httplib2 rlcompleter xxsubtype
ast idlelib robotparser yaml
asynchat ihooks rsa yt
asyncore image runpy zipfile
atexit imageext rwobject zipimport
audiodev imageop sched zlib
Enter any module name to get more help. Or, type "modules spam" to search
for modules whose descriptions contain the word "spam".
I update some module with pip2.7 C:\Python27\Scripts>C:\Python27\python.exe
Python 2.7.11rc1 (v2.7.11rc1:82dd9545bd93, Nov 21 2015, 23:25:27) [MSC v.1500 64
bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import pip
>>> from subprocess import call
>>>
>>> for dist in pip.get_installed_distributions():
... call("pip2.7.exe install --upgrade " + dist.project_name, shell=True)
...
Requirement already up-to-date: appdirs in c:\python27\lib\site-packages
0
Requirement already up-to-date: BeautifulSoup in c:\python27\lib\site-packages
0
Collecting beautifulsoup4
Downloading beautifulsoup4-4.4.1-py2-none-any.whl (81kB)
100% |################################| 81kB 327kB/s
Installing collected packages: beautifulsoup4
Found existing installation: beautifulsoup4 4.3.2
Uninstalling beautifulsoup4-4.3.2:
Successfully uninstalled beautifulsoup4-4.3.2
Successfully installed beautifulsoup4-4.4.1
0
Some python modules has problems with update...
Failed building wheel for pycuda
Note:C:\Python34\Scripts>pip3.4.exe install sympy
Collecting sympy
Downloading sympy-0.7.6.tar.gz (6.4MB)
100% |################################| 6.4MB 35kB/s
Building wheels for collected packages: sympy
...
Successfully built sympy
Installing collected packages: sympy
Successfully installed sympy-0.7.6
For a short introduction into SymPy python module I will show you the printing features.C:\Python34>python
Python 3.4.1 (v3.4.1:c0e311e010fc, May 18 2014, 10:45:13) [MSC v.1600 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from sympy import *
>>> x,y,z = symbols('x y z')
>>> Integral(sqrt(1+1/x),x)
Integral(sqrt(1 + 1/x), x)
>>> init_session(quiet=True)
Python console for SymPy 0.7.6 (Python 3.4.1-64-bit) (ground types: python)
>>> Integral(sqrt(1+1/x),x)
/
|
| _______
| / 1
| / 1 + - dx
| \/ x
|
/
>>>
How to print one matrix :>>> x, y, z = symbols('x, y, z')
>>> init_session(quiet=True)
Python console for SymPy 0.7.6 (Python 3.4.1-64-bit) (ground types: python)
>>> mat = Matrix([x*y, 1,0,3,-2, sin(z)])
>>> mat
[ x*y ]
[ ]
[ 1 ]
[ ]
[ 0 ]
[ ]
[ 3 ]
[ ]
[ -2 ]
[ ]
[sin(z)]
>>>
Next example come with this issue: equations can be solved with SymPy python module.>>> solve(x*x+x+2)
___ ___
1 \/ 7 *I 1 \/ 7 *I
[- - - -------, - - + -------]
2 2 2 2
>>> solve(Eq(x*x+x+2))
___ ___
1 \/ 7 *I 1 \/ 7 *I
[- - - -------, - - + -------]
2 2 2 2
>>> solve(Eq(x*x+2*x+4))
___ ___
[-1 - \/ 3 *I, -1 + \/ 3 *I]
>>> solve(x*x+2*x+4)
___ ___
[-1 - \/ 3 *I, -1 + \/ 3 *I]
>>>
>>> import numpy
Traceback (most recent call last):
File "", line 1, in
File "C:\Python34\lib\site-packages\numpy\__init__.py", line 170, in
from . import add_newdocs
File "C:\Python34\lib\site-packages\numpy\add_newdocs.py", line 13, in
from numpy.lib import add_newdoc
File "C:\Python34\lib\site-packages\numpy\lib\__init__.py", line 8, in
from .type_check import *
File "C:\Python34\lib\site-packages\numpy\lib\type_check.py", line 11, in
import numpy.core.numeric as _nx
File "C:\Python34\lib\site-packages\numpy\core\__init__.py", line 6, in
from . import multiarray
ImportError: DLL load failed: %1 is not a valid Win32 application.
How to fix this:C:\Python34\Scripts>pip3.4.exe install --upgrade wheel
Requirement already up-to-date: wheel in c:\python34\lib\site-packages
C:\Python34\Scripts>pip3.4.exe install "C:\Users\...\Downloads\numpy-1.9.2+m
kl-cp34-none-win_amd64.whl"
After that you can import the numpy module
>>> import PySide
>>> from PySide import *
>>> dir(PySide)
['QtCore', 'QtGui', 'QtNetwork', 'QtOpenGL', 'QtScript', 'QtSql', 'QtSvg', 'QtTe
st', 'QtWebKit', '__all__', '__builtins__', '__doc__', '__file__', '__name__', '
__package__', '__path__', '__version__', '__version_info__', '_setupQtDirectorie
s', '_utils']
Also this can help you to see all about Qt components and versions using by PySide:# prints PySide version
>>> print PySide.__version__
1.2.2
# gets a tuple with each version component
>>> print PySide.__version_info__
(1, 2, 2, 'final', 0)
# prints the Qt version used to compile PySide
>>> print PySide.QtCore.__version__
4.8.5
# gets a tuple with each version components of Qt used to compile PySide
>>> print PySide.QtCore.__version_info__
(4, 8, 5)
Something about PySide submodules:>>> import sys
...
>>> from PySide import QtGui
...
>>> app = QtGui.QApplication(sys.argv)
You need sys python module also the application can have this option : sys.argv .>>> import sys
>>> import PySide
>>> from PySide import *
>>> myapp = QtGui.QApplication(sys.argv)
>>> mywidgets = QtGui.QWidget()
>>> mywidgets.show()
The title of your application will be python.mywidgets.setWindowTitle('my app title ')
About my class Example from pyside-introduction-part-001 then I will tell you how to make one simple class example.class Example(QtGui.QWidget):
...
#defaul init class method
__init__(self)
...
#make and show the window application
initUI(self)
...
#my method to put the window to the desktop screen
center(self)
...
#method to deal with events and also close the application
closeEvent(self, event)
...
Into __init___ I used super() method.app = QtGui.QApplication(sys.argv)
and also put my widgets under this with this python code:ex = Example()
About events I will make another tutorial ...Python 3.5.0a4 (v3.5.0a4:413e0e0004f4, Apr 19 2015, 18:01:47) [MSC v.1900 64 bit
(AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>
Let's see all defaul Python35 modules:__future__ abc hmac select
_ast aifc html selectors
_bisect antigravity http setuptools
_bootlocale argparse idlelib shelve
_bz2 array imaplib shlex
_codecs ast imghdr shutil
_codecs_cn asynchat imp signal
_codecs_hk asyncio importlib site
_codecs_iso2022 asyncore inspect smtpd
_codecs_jp atexit io smtplib
_codecs_kr audioop ipaddress sndhdr
_codecs_tw base64 itertools socket
_collections bdb json socketserver
_collections_abc binascii keyword sqlite3
_compat_pickle binhex lib2to3 sre_compile
_compression bisect linecache sre_constant
_csv builtins locale sre_parse
_ctypes bz2 logging ssl
_ctypes_test cProfile lzma stat
_datetime calendar macpath statistics
_decimal cgi macurl2path string
_dummy_thread cgitb mailbox stringprep
_elementtree chunk mailcap struct
_functools cmath marshal subprocess
_hashlib cmd math sunau
_heapq code mimetypes symbol
_imp codecs mmap symtable
_io codeop modulefinder sys
_json collections msilib sysconfig
_locale colorsys msvcrt tabnanny
_lsprof compileall multiprocessing tarfile
_lzma concurrent netrc telnetlib
_markerlib configparser nntplib tempfile
_markupbase contextlib nt test
_md5 copy ntpath textwrap
_msi copyreg nturl2path this
_multibytecodec crypt numbers threading
_multiprocessing csv opcode time
_opcode ctypes operator timeit
_operator curses optparse tkinter
_osx_support datetime os token
_overlapped dbm parser tokenize
_pickle decimal pathlib trace
_pydecimal difflib pdb traceback
_pyio dis pickle tracemalloc
_random distutils pickletools tty
_sha1 doctest pip turtle
_sha256 dummy_threading pipes turtledemo
_sha512 easy_install pkg_resources types
_signal email pkgutil unicodedata
_sitebuiltins encodings platform unittest
_socket ensurepip plistlib urllib
_sqlite3 enum poplib uu
_sre errno posixpath uuid
_ssl faulthandler pprint venv
_stat filecmp profile warnings
_string fileinput pstats wave
_strptime fnmatch pty weakref
_struct formatter py_compile webbrowser
_symtable fractions pyclbr winreg
_testbuffer ftplib pydoc winsound
_testcapi functools pydoc_data wsgiref
_testimportmultiple gc pyexpat xdrlib
_thread genericpath queue xml
_threading_local getopt quopri xmlrpc
_tkinter getpass random xxsubtype
_tracemalloc gettext re zipapp
_warnings glob reprlib zipfile
_weakref gzip rlcompleter zipimport
_weakrefset hashlib runpy zlib
_winapi heapq sched
Also the this version come with pip3.5 under Script folder to use pip solution.