<?xml version="1.0" encoding="utf-8" ?><?xml-stylesheet type="text/xsl" href="http://www.daniweb.com/js/rss.xsl"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
	<channel>
		<title>DaniWeb IT Discussion Community
			 - Python			Code Snippets					</title>
		<link>http://www.daniweb.com/software-development/python/code/_/114</link>
		<description>Our Python forum is the place for Q&amp;A-style discussions related to this interpreted OOP language.</description>
		<language>en-US</language>
		<ttl>60</ttl>
		<!-- PubSubHubbub Discovery -->
		<link rel="hub" href="http://daniweb.superfeedr.com/" xmlns="http://www.w3.org/2005/Atom" />
		<link rel="self" href="http://www.daniweb.com/rss/pull/114/code" xmlns="http://www.w3.org/2005/Atom" />
		<!-- End Of PubSubHubbub Discovery -->
				<item>
			<title>Let PyGame play your MIDI or MP3 files</title>
			<link>http://www.daniweb.com/software-development/python/code/454835/let-pygame-play-your-midi-or-mp3-files</link>
			<pubDate>Fri, 17 May 2013 16:12:24 +0000</pubDate>
			<description>Just a code sample that allows you to play your midi or mp3 music files with Python and module pygame.</description>
			<content:encoded><![CDATA[ <p>Just a code sample that allows you to play your midi or mp3 music files with Python and module pygame.</p>
 ]]></content:encoded>
			<category domain="http://www.daniweb.com/software-development/python/114">Python</category>
			<dc:creator>vegaseat</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/software-development/python/code/454835/let-pygame-play-your-midi-or-mp3-files</guid>
		</item>
				<item>
			<title>Save a PyGame drawing</title>
			<link>http://www.daniweb.com/software-development/python/code/454765/save-a-pygame-drawing</link>
			<pubDate>Thu, 16 May 2013 17:48:42 +0000</pubDate>
			<description>You can draw a number of shapes directly on the PyGame window, and then save the drawing to an image file.</description>
			<content:encoded><![CDATA[ <p>You can draw a number of shapes directly on the PyGame window, and then save the drawing to an image file.</p>
 ]]></content:encoded>
			<category domain="http://www.daniweb.com/software-development/python/114">Python</category>
			<dc:creator>vegaseat</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/software-development/python/code/454765/save-a-pygame-drawing</guid>
		</item>
				<item>
			<title>How to use docopt to parse command-line options</title>
			<link>http://www.daniweb.com/software-development/python/code/454621/how-to-use-docopt-to-parse-command-line-options</link>
			<pubDate>Tue, 14 May 2013 22:43:48 +0000</pubDate>
			<description>I just wanted to show the basic usage of docopt, a module that makes parsing command-line arguments so much easier. I'm not affiliated with the creators of docopt, but I'm certainly thankful for their work and happy to post this little snippet. I will point you to [docopt.org](http://docopt.org) for more ...</description>
			<content:encoded><![CDATA[ <p>I just wanted to show the basic usage of docopt, a module that makes parsing command-line arguments so much easier. I'm not affiliated with the creators of docopt, but I'm certainly thankful for their work and happy to post this little snippet. I will point you to <a href="http://docopt.org" rel="nofollow">docopt.org</a> for more information because there is so much more you can do with this module, that I'm not showing you here. Watch the video, it was an eye-opener for me. Also, if you'd like to install docopt you can go to their <a href="https://github.com/docopt/docopt" rel="nofollow">github repo</a> to download and install it.</p>

<p>Try running this script in different ways to see the results, any invalid arguments will kick the user out to a Usage message (which also happens to be the way docopt recognizes valid or invalid arguments, awesome). The -h and --help flags are automagically recognized and used, so no code for them needs to be written:</p>

<pre><code class="language-py">./docopt_example.py -h
./docopt_example.py myrequiredargument
./docopt_example.py myrequiredargument -f
./docopt_example.py myrepeatingarg1 myrepeatingarg2 myrepeatingarg3
</code></pre>
 ]]></content:encoded>
			<category domain="http://www.daniweb.com/software-development/python/114">Python</category>
			<dc:creator>chriswelborn</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/software-development/python/code/454621/how-to-use-docopt-to-parse-command-line-options</guid>
		</item>
				<item>
			<title>Moon Phase at a given date (Python)</title>
			<link>http://www.daniweb.com/software-development/python/code/453788/moon-phase-at-a-given-date-python</link>
			<pubDate>Thu, 02 May 2013 21:19:30 +0000</pubDate>
			<description>For those who are afraid of lycanthropes and full moons, here is a way to figure out the phase of the moon.</description>
			<content:encoded><![CDATA[ <p>For those who are afraid of lycanthropes and full moons, here is a way to figure out the phase of the moon.</p>
 ]]></content:encoded>
			<category domain="http://www.daniweb.com/software-development/python/114">Python</category>
			<dc:creator>vegaseat</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/software-development/python/code/453788/moon-phase-at-a-given-date-python</guid>
		</item>
				<item>
			<title>Get multiple file names (PyQT/PySide)</title>
			<link>http://www.daniweb.com/software-development/python/code/452624/get-multiple-file-names-pyqtpyside</link>
			<pubDate>Tue, 16 Apr 2013 15:27:56 +0000</pubDate>
			<description>A simple test of PySide's QFileDialog widget and its method getOpenFileNames. Use method getOpenFileName if you want just one file name.</description>
			<content:encoded><![CDATA[ <p>A simple test of PySide's QFileDialog widget and its method getOpenFileNames.  Use method getOpenFileName if you want just one file name.</p>
 ]]></content:encoded>
			<category domain="http://www.daniweb.com/software-development/python/114">Python</category>
			<dc:creator>vegaseat</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/software-development/python/code/452624/get-multiple-file-names-pyqtpyside</guid>
		</item>
				<item>
			<title>Projectile Motion (Python)</title>
			<link>http://www.daniweb.com/software-development/python/code/450564/projectile-motion-python</link>
			<pubDate>Wed, 20 Mar 2013 16:22:38 +0000</pubDate>
			<description>This example calculates timed x, y points of a projectile motion that can be used for plotting or other calculations.</description>
			<content:encoded><![CDATA[ <p>This example calculates timed x, y points of a projectile motion that can be used for plotting or other calculations.</p>
 ]]></content:encoded>
			<category domain="http://www.daniweb.com/software-development/python/114">Python</category>
			<dc:creator>vegaseat</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/software-development/python/code/450564/projectile-motion-python</guid>
		</item>
				<item>
			<title>Resize an Image from the Web (PIL, Tkinter)</title>
			<link>http://www.daniweb.com/software-development/python/code/450373/resize-an-image-from-the-web-pil-tkinter</link>
			<pubDate>Mon, 18 Mar 2013 19:46:35 +0000</pubDate>
			<description>Similiar to the snippet posted at: http://www.daniweb.com/software-development/python/code/449036/display-an-image-from-the-web-tkinter but this time we use PIL to resize the image from the internet keeping its aspect ratio to fit a specific display area/box.</description>
			<content:encoded><![CDATA[ <p>Similiar to the snippet posted at:<br />
<a href="http://www.daniweb.com/software-development/python/code/449036/display-an-image-from-the-web-tkinter" rel="nofollow">http://www.daniweb.com/software-development/python/code/449036/display-an-image-from-the-web-tkinter</a><br />
but this time we use PIL to resize the image from the internet keeping its aspect ratio to fit a specific display area/box.</p>
 ]]></content:encoded>
			<category domain="http://www.daniweb.com/software-development/python/114">Python</category>
			<dc:creator>vegaseat</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/software-development/python/code/450373/resize-an-image-from-the-web-pil-tkinter</guid>
		</item>
				<item>
			<title>Display an Image from the Web (Tkinter)</title>
			<link>http://www.daniweb.com/software-development/python/code/449036/display-an-image-from-the-web-tkinter</link>
			<pubDate>Fri, 01 Mar 2013 21:48:03 +0000</pubDate>
			<description>Simple code to show you how to display an image from a Web URL using the Tkinter Python GUI toolkit, the Python Image Library (PIL) and the data_stream created with io.BytesIO().</description>
			<content:encoded><![CDATA[ <p>Simple code to show you how to display an image from a Web URL using the Tkinter Python GUI toolkit, the Python Image Library (PIL) and the data_stream created with io.BytesIO().</p>
 ]]></content:encoded>
			<category domain="http://www.daniweb.com/software-development/python/114">Python</category>
			<dc:creator>vegaseat</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/software-development/python/code/449036/display-an-image-from-the-web-tkinter</guid>
		</item>
				<item>
			<title>Number of Permutations (Python)</title>
			<link>http://www.daniweb.com/software-development/python/code/448888/number-of-permutations-python</link>
			<pubDate>Wed, 27 Feb 2013 22:50:34 +0000</pubDate>
			<description>This snippet allows you to find the number of ordered permutations of items taken from a population of known size. It uses the well know algorithm with factorials. For very large populations you may want to use an approximation of factorials.</description>
			<content:encoded><![CDATA[ <p>This snippet allows you to find the number of ordered permutations of items taken from a population of known size.  It uses the well know algorithm with factorials.  For very large populations you may want to use an approximation of factorials.</p>
 ]]></content:encoded>
			<category domain="http://www.daniweb.com/software-development/python/114">Python</category>
			<dc:creator>vegaseat</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/software-development/python/code/448888/number-of-permutations-python</guid>
		</item>
				<item>
			<title>Number of Combinations (Python)</title>
			<link>http://www.daniweb.com/software-development/python/code/448886/number-of-combinations-python</link>
			<pubDate>Wed, 27 Feb 2013 22:34:22 +0000</pubDate>
			<description>If you want to know the number of combinations of x things taken n at a time, you can use the Python module gmpy. The module gmpy is a C-coded Python extension module that supports fast multiple-precision arithmetic, very handy if x things reach a large number.</description>
			<content:encoded><![CDATA[ <p>If you want to know the number of combinations of x things taken n at a time, you can use the Python module gmpy. The module gmpy is a C-coded Python extension module that supports fast multiple-precision arithmetic, very handy if x things reach a large number.</p>
 ]]></content:encoded>
			<category domain="http://www.daniweb.com/software-development/python/114">Python</category>
			<dc:creator>vegaseat</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/software-development/python/code/448886/number-of-combinations-python</guid>
		</item>
			</channel>
</rss>