How do I make python to wait for a pressed key
I want my script to wait until my users presses the any key. How do I do that? ...
I want my script to wait until my users presses the any key. How do I do that? ...
I have to write a desktop application to edit data stored in a XML File. The Format is defined by a XML Schema File (.xsd). The Format is quite complex. Are there tools which can generate a basic gui automatically? It's not yet decided which language to use. I have experience in Python and C++ using wxWidgets and C# (.Net1) using Windows...
How do I initialise a list with 10 times a default value in Python? I'm searching for a good-looking way to initialize a empty list with a specific range. So make a list that contains 10 zeros or something to be sure that my list has a specific length. ...
Can I call a Flatpage from with a view. Say I have some code like: def myview(request): if request.subdomain != "www": return HttpResponseRedirect("http://"+request.subdomain+".mydomain/login/") else: call the flatpage here... ...
I'm trying to encode data to JSON in Python and I been having a quite a bit of trouble. I believe the problem is simply a misunderstanding. I'm relatively new to Python and never really got familiar with the various Python data types, so that's most likely what's messing me up. Currently I am declaring a list, looping through and ano...
I'm experimenting with app-engine-patch (Django for GAE) on Google App Engine. And I would like to write a Facebook application. Is it possible to use PyFacebook and its middleware? Or is there some other solution? ...
I'm trying to replace a string in all the files within the current directory. for some reason, my temp file ends up blank. It seems my .write isn't working because the secondfile was declared outside its scope maybe? I'm new to python, so still climbing the learning curve...thanks! edit: I'm aware my tempfile isn't being copied current...
I've found a PHP script that lets me do what I asked in this SO question. I can use this just fine, but out of curiosity I'd like to recreate the following code in Python. I can of course use urllib2 to get the page, but I'm at a loss on how to handle the cookies since mechanize (tested with Python 2.5 and 2.6 on Windows and Python 2...
I want to do some validation whenever the value of a textfield changes. I don't see an on change event mentioned in the documentation though. ...
Any good summary articles of the dynamic language and meta-programming features of Python that get utilized by Django? Or can we build that out here? Setting this up as a wiki-style entry. ...
In my Django application I get times from a webservice, provided as a string, that I use in my templates: {{date.string}} This provides me with a date such as: 2009-06-11 17:02:09+0000 These are obviously a bit ugly, and I'd like to present them in a nice format to my users. Django has a great built in date formatter, which would do ...
I'm trying to create a custom timestamp field. class TimestampKey(models.CharField): __metaclass__ = models.SubfieldBase def __init__(self, *args, **kwargs): import time kwargs['unique'] = True kwargs['max_length'] = 20 kwargs['auto_created'] = True kwargs['editable']=False super(TimestampKey, sel...
I have a CustomDialog I made to let the user configure settings. Normally I want this to be launched from a menu item within the main application which works fine. But during the install, I want to launch just the dialog to let the user configure the settings. Is there a way I can have both? ...
Hello there everyone, I have searched for other posts, as I felt this is a rather common problem, but all other Python exception questions I have found didn't reflect my problem. I will try to be as specific here as I can, so I will give a direct example. And pleeeeease do not post any workarounds for this specific problem. I am not spe...
I'm designing a simple text editor using WxPython, and I want to put the platform's native icons in the toolbar. It seems that the only way to make toolbars is with custom images, which are not good for portability. Is there some kind of (e.g.) GetSaveIcon()? ...
My data structure is initialized as follows: [[0,0,0,0,0,0,0,0] for x in range(8)] 8 characters, 8 rows, each row has 5 bits for columns, so each integer can be in the range between 0 and 31 inclusive. I have to convert the number 177 (can be between 0 and 319) into char, row, and column. Let me try again, this time with a better co...
I'm trying to launch an 'rsync' using subprocess module and Popen inside of a thread. After I call the rsync I need to read the output as well. I'm using the communicate method to read the output. The code runs fine when I do not use a thread. It appears that when I use a thread it hangs on the communicate call. Another thing I've notice...
I am looking to build a medical solution to be used by surgeons to visualize Dicom images in 3D. Also, the software will allow them to perform some segmentation and manipulation to the images. I will probably use the VTK package www.vtk.org/ to assist with this project. Now, I am wondering whether it is easier and better to do this pr...
Hello all, In Google App Engine, I have the following code which shows a simple HTML page. import os from google.appengine.ext.webapp import template from google.appengine.ext import webapp class IndexHandler(webapp.RequestHandler): def get(self): template_values = { } path = os.path.join(os.path.dirname(__file__), '../tem...
Python is filled with little neat shortcuts. For example: self.data = map(lambda x: list(x), data) and (although not so pretty) tuple(t[0] for t in self.result if t[0] != 'mysql' and t[0] != 'information_schema') among countless others. In the irc channel, they said "too many to know them all". I think we should list some here,...