<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Non blocking console input in Python and Java</title>
	<atom:link href="http://www.darkcoding.net/software/non-blocking-console-io-is-not-possible/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.darkcoding.net/software/non-blocking-console-io-is-not-possible/</link>
	<description>Solvitas perambulum</description>
	<lastBuildDate>Thu, 29 Jul 2010 06:43:17 -0500</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Bill Hamilton</title>
		<link>http://www.darkcoding.net/software/non-blocking-console-io-is-not-possible/comment-page-1/#comment-18188</link>
		<dc:creator>Bill Hamilton</dc:creator>
		<pubDate>Mon, 21 Dec 2009 20:14:18 +0000</pubDate>
		<guid isPermaLink="false">http://www.darkcoding.net/software/non-blocking-console-io-is-not-possible/#comment-18188</guid>
		<description>Hey There,

I find your solution was not very elegant in python. Unfortunately Im using mac and although I LOVE pygame, I cant seem to get it to work. Also Im using console and don&#039;t want to be unix specific. So what I did is this:

from threading import Thread
program_run = True

class waitOnInput(Thread):
	def run(self):
		global program_run
		thread_run = True
		while thread_run :
			data = raw_input(&#039;input command (q for quit)-&gt;&#039;)
			print &#039;got input : &#039;, data
			if data == &#039;q&#039; :
				thread_run = False
				program_run = False

while program_run :
      t = waitOnInput()
      t.start()
      #do stuff

t.join()</description>
		<content:encoded><![CDATA[<p>Hey There,</p>
<p>I find your solution was not very elegant in python. Unfortunately Im using mac and although I LOVE pygame, I cant seem to get it to work. Also Im using console and don&#8217;t want to be unix specific. So what I did is this:</p>
<p>from threading import Thread<br />
program_run = True</p>
<p>class waitOnInput(Thread):<br />
	def run(self):<br />
		global program_run<br />
		thread_run = True<br />
		while thread_run :<br />
			data = raw_input(&#8217;input command (q for quit)-&gt;&#8217;)<br />
			print &#8216;got input : &#8216;, data<br />
			if data == &#8216;q&#8217; :<br />
				thread_run = False<br />
				program_run = False</p>
<p>while program_run :<br />
      t = waitOnInput()<br />
      t.start()<br />
      #do stuff</p>
<p>t.join()</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Codifex Maximus</title>
		<link>http://www.darkcoding.net/software/non-blocking-console-io-is-not-possible/comment-page-1/#comment-16907</link>
		<dc:creator>Codifex Maximus</dc:creator>
		<pubDate>Mon, 09 Mar 2009 14:23:02 +0000</pubDate>
		<guid isPermaLink="false">http://www.darkcoding.net/software/non-blocking-console-io-is-not-possible/#comment-16907</guid>
		<description>Graham,

Your notes on Python non-blocking console input on Linux were extremely helpful.

The listed code seems to work fine in Solaris as well.  Because the code is based on POSIX, it *should* be cross-platform capable.  I haven&#039;t tested it on Windows though.

Thank you,
Codifex</description>
		<content:encoded><![CDATA[<p>Graham,</p>
<p>Your notes on Python non-blocking console input on Linux were extremely helpful.</p>
<p>The listed code seems to work fine in Solaris as well.  Because the code is based on POSIX, it *should* be cross-platform capable.  I haven&#8217;t tested it on Windows though.</p>
<p>Thank you,<br />
Codifex</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: schlenk</title>
		<link>http://www.darkcoding.net/software/non-blocking-console-io-is-not-possible/comment-page-1/#comment-15155</link>
		<dc:creator>schlenk</dc:creator>
		<pubDate>Mon, 31 Dec 2007 12:36:42 +0000</pubDate>
		<guid isPermaLink="false">http://www.darkcoding.net/software/non-blocking-console-io-is-not-possible/#comment-15155</guid>
		<description>Thats just plain wrong and just a limitation of your console code.

On Unix you can set your console from cooked to raw mode with the right stty invocation before running your stuff and then have the behaviour you need. On windows you just need a lib to configure your console correctly and you get single char input just fine. Most libs use line input on windows though, but thats just a matter of adding some flags when configuring the console.

See http://msdn2.microsoft.com/en-us/library/ms686033(VS.85).aspx

Michael</description>
		<content:encoded><![CDATA[<p>Thats just plain wrong and just a limitation of your console code.</p>
<p>On Unix you can set your console from cooked to raw mode with the right stty invocation before running your stuff and then have the behaviour you need. On windows you just need a lib to configure your console correctly and you get single char input just fine. Most libs use line input on windows though, but thats just a matter of adding some flags when configuring the console.</p>
<p>See <a href="http://msdn2.microsoft.com/en-us/library/ms686033(VS.85).aspx" rel="nofollow">http://msdn2.microsoft.com/en-us/library/ms686033(VS.85).aspx</a></p>
<p>Michael</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bob</title>
		<link>http://www.darkcoding.net/software/non-blocking-console-io-is-not-possible/comment-page-1/#comment-15151</link>
		<dc:creator>Bob</dc:creator>
		<pubDate>Mon, 31 Dec 2007 01:42:40 +0000</pubDate>
		<guid isPermaLink="false">http://www.darkcoding.net/software/non-blocking-console-io-is-not-possible/#comment-15151</guid>
		<description>I think you mean &quot;Non-blocking console IO is not possible in the languages I&#039;m using.&quot;

For everyone else non-blocking IO is a piece of cake.  Try checking out the man pages for fcntl, paying special attention to the O_NONBLOCK flag.
</description>
		<content:encoded><![CDATA[<p>I think you mean &#8220;Non-blocking console IO is not possible in the languages I&#8217;m using.&#8221;</p>
<p>For everyone else non-blocking IO is a piece of cake.  Try checking out the man pages for fcntl, paying special attention to the O_NONBLOCK flag.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
