text
stringlengths
226
34.5k
Unable to get python embedded to work with zip'd library Question: I'm trying to embed python, and provide the dll and a zip of the python libraries and not use any installed python. That is, if a user doesn't have python, I want my code to work using the provided dll/zip. This [post](http://stackoverflow.com/question...
Real-time visualisations with audio and video, which direction should I look? Question: I have a little pet project with a friend where we're looking to create a program for real-time visualisations, mainly utilising audio/video material, controlled by MIDI. Now, the MIDI part is not a problem, you seem to find decent ...
Abstract Base Classes versus Duck Typing Question: Python has specific [ABCs for container types](http://docs.python.org/3/library/collections.abc.html). It says they're, "…used to test whether a class provides a particular interface." (And that they're also useful for some mixins, but let's ignore that for the moment....
Error Trying to Import JSON to Django Database - TypeError: string indices must be integers Question: I've been self-teaching myself programming for less than a month. I'm trying to build a Django site to help the process. I've spent the last 3 days searching for a solution to this problem to no avail. I stole this co...
Python all combinations of data Question: So I have a file structure like this _(data on each line)_ : A B C ... I want to read each line of this file and combine those into all possible combinations, the result I'm looking for would be this _(which I would put in a list)_ : ...
for loop in for loop, python, csv reader/writer Question: I am new in python, but after 3 days of reading and finding solution without success i am lost. I've got mysql table with data (id, user_id...). I connect to db, read user_id and save data into array "user". Then i open csv file with a lot of rows and columns (...
Simple Python - Error in Programming Question: I've been stuck on this issue for over two hours, this is homework so please don't give me a direct answer just point me in the right direction. So... This program is designed to input a "speed limit", input "Current speed" and give you a print response of either "Speed O...
Excluding web links with specific extensions in web scraper Question: I need to exclude printing links in my web scraper that end in .od .jpg .pdf or .mp3 Here's my `if` statement if link in linkList(): print link Is there some library in Python for that? I only know of"RegEx" but I'm no...
Create a xls file from a dict python Question: Anyone knows how to create a xls file from a dict? I have a dictionary filled with words in a text, i want to put this DICT in a xls def contar_Repetidas(texto): dic={} l=texto.split() for palabra in l: if palabra not in d...
Dynamic Library causes error when added to setup.py file (on Mac OS.X) Question: I have a dynamic library, built in cpp that actually works in cpp but is causing much headache when I try to import it from a python class. The error appears simply when I add the lib to my setup.py file. Error: MacBook-Pro-...
Adding Button and Separate Window to Python QProcess Example Question: I'm trying to use QProcess and read the stdout to a QTextEdit initiated by a button. How can I adapt [this example](http://codeprogress.com/python/libraries/pyqt/showPyQTExample.php?index=408&key=QTextEditRedStdOutput) to do so? Do I have to call a ...
removing specific row in csv file, python Question: I woud like to remove (delete) specific rows in csv file. But there are some conditions. 1.) File can't be buffered in memmory, becuse of it's size (1GB+) 2.) File MUST NOT be "touched" (rewriting file) My job is just to delete some rows in c...
understanding nltk with python Question: My nltk data is `~/nltk_data/corpora/words/(en,en-basic,README)` According to `__init__.py` inside `~/lib/python2.7/site-packages/nltk/corpus`, to read a list of the words in the Brown Corpus, use `nltk.corpus.brown.words()`: from nltk.corpus import brown pri...
Creating Matplotlib Toolbar in Python Traits Editor Question: I'm working on a QT4 Traits-GUI in Python using Matplotlib for image display, and so far I have [this](https://mail.enthought.com/pipermail/enthought- dev/2012-May/031065.html) editor modified in an attempt to include a toolbar. from traitsui....
Python text processing and parsing Question: I have a file in `gran/config.py` AND I cannot import this file (not an option). Inside this config.py, there is the following code ...<more code> animal = dict( bear = r'^bear4x', tiger = r'^.*\tiger\b.*$' ) ...
How to avoid hanging Xvfb processes [while using PyVirtualDisplay]? Question: Trying to find how to avoid hanging Xvfb processes in our Python application, when using PyVirtualDisplay. The essential problem is that calling `display.stop()` (see code sample below) does not seem to properly shut down the Xvfb process. P...
Python Multiprocessing Kill Processes Question: I am learning how to use the Python multiprocessing library. However, while I am going through some of the examples, I ended up with many python processes running in my background. One of the [example](http://docs.python.org/2/library/multiprocessing.html) looks like bel...
Matplotlib imshow() too many objects for cmap Question: I'm trying to create a simple imshow() plot (matplotlib v.1.2.1) of a 2D gaussian function: import matplotlib.pyplot as plt import numpy as np from pylab import * def gaussian(x,y,stdx,stdy): return 1.0/(2*np.pi*stdx*stdy) *...
Aggregate and fill data for missing dates (days and hours) Question: Suppose we have a list like this showing the count of each object on a particular date (mm-dd-yyyy-hour-minute): A = [ [ ['07-07-2012-21-04', 'orange', 1], ['08-16-2012-08-57', 'orange', 1], ['08-18-2012-03-...
Why Ruby and Python long division differs from GMP and Java BigInteger? Question: I'm developing a Big Integer class(didactic purpose) and I have been using Ruby to generate test cases. My class fails in the following test: a = -4819717457043153198766885293980767437743518897414877941636690527464203172968...
Python Dictionary value assignment with list comprehension Question: I would like to take a python dictionary of lists, convert the lists to numpy arrays, and restore them in the dictionary using list comprehension. For example, if I had a dictionary myDict = {'A':[1,2,3,4], 'B':[5,6,7,8], 'C':'str', 'D...
Migrating Excel financial model to and Corkscrew calculation in Python Pandas Question: I'm working on replacing an Excel financial model into Python Pandas. By financial model I mean forecasting a cash flow, profit & loss statement and balance sheet over time for a business venture as opposed to pricing swaps / option...
Python multicore without communication Question: I want to call a methode getRecommendations which just pickle recommendations to a specific user to a file. I used a code from a book which works. But I saw that only one core works and I want that all my cores do the work, because this would be much faster. Here is the...
Python: Unzipping and decompressing .Z files inside .zip Question: I am trying to unzip a Alpha.zip folder which contains a Beta directory which contains a Gamma Folder which contains a.Z, b.Z, c.Z, d.Z files. Using zip and 7-zip I was able to extract all a.D, b.D, c.D, d.D files stored within the .Z files. I tried th...
Django to desktop app with pyinstaller Question: I'm trying to convert a django project into a desktop app. I've downloaded the developer version of pyinstaller: github/pyinstaller/pyinstaller. hookutils.py is modified as stated here: <http://www.pyinstaller.org/ticket/754> in order for pyinstaller to find my root dir...
Append to several lists inside list Question: I have an empty list of empty lists defined like so: lis_A = [[], [], []] to which I need, at some point in my code, to append values recursively like so: lis_A[0].append(some_value0) lis_A[1].append(some_value1) lis_A[2].append(s...
Python - Process Disappearing and Freezing when working with large Dict? Question: I'm in the process of dealing with XML files that are about 85MB in size. Currently I'm just trying to process one. What I'm doing is download a zip, extract to disk, then convert the XML to a Python Dict, change a couple things, then sa...
importing system in python - import packages Question: When I have the following packages: src /__main__.py /dir1 /__init__.py /main_code1.py /service.py /config.py /dir2 /__init__.py /maincode2.py /dir3 ...
How to remove insignificant whitespace in lxml.html? Question: I'm rather surprised that lxml.html leaves insignificant whitespace when parsing HTML by default. I'm also surprised that I can't find any obvious way to make it not do that. Python 2.7.3 (default, Apr 10 2013, 06:20:15) [GCC 4.6.3] on l...
Django error while template rendering: NoReverseMatch found Question: The following piece of code is throwing an error. I searched for the solution, but couldn't find anything which is pertaining to my scenario. Any help would be appreciated. #urls.py url(r'^password/reset/confirm/(?P<uidb36>[0-9A-Za...
How to make a text dialogue appear in wxpython Question: I have been looking around the web since early morning and I can't seem to figure out how to get wxPython to show a dialogue box on my main frame. import wx class MainWindow(wx.Frame): def __init__(self,parent,id): ...
strange result in using python's property Question: I spent some time to learn Python's property magic. But when I am writing a simple case with a small mistake, I get a strange result. Here is my code: class PropertyShow(object): def __init__(self): self.__num = 90 def ...
python if $_GET is empty do something & url path Question: import cgi form = cgi.FieldStorage() test = form['name'].value if test is None: print('empty') else: print ('Hello ' + test) ... and that doesn't seem to display anything when my url is something like .../1.p...
How to include python-dateutil in Google App Engine? Question: How can I use the `python-dateutil` library in Google App Engine? I am using the `webapp2` framework and need to know how to include the library and use it in my script. Answer: EDIT2: Here's the recommended way to do this now: <https://cloud.google.com/a...
Use regex to add string to different multilines with simularities Question: I have a .txt file with multiple lines (Different yet simular for each one) that I want to add a "*.tmp" at the end. I'm trying to use python2.7 regex to do this. Here is what I have for the python script: import sys import...
Python to C++ Program Questions Question: It's my second week of my junior year of college and my professor has given me the assignment of taking a python program, which i'm very familiar with, and turning it into a C++ program. I know next to nothing about C++ having only had 1 lecture on the topic and my book not arr...
PyGTK, "do-configure-event" doesn't work? Question: The title of the window doesn't display event.x && event.y (see the code :D) . I discover the method do_configure_event doesn't been called. new to pygtk, many thx! :D #!/usr/bin/env python2.7 # encoding:utf8 # sources: zetcode import gtk ...
Watermark GIF with Python PIL Question: I'm trying to find a way to watermark a gif image, below is my code: img = Image.open("my.gif") watermark = Image.open("watermark.gif") img.paste(watermark, (1, 1)) img.save("out.gif") File: my.gif: ![my.gif](http://i.stack.imgur.com/5vCFj.g...
Python extracting sentence containing 2 words Question: I have the same problem that was discussed in this link [Python extract sentence containing word](http://stackoverflow.com/questions/16032832/python- extract-sentence-containing-word), but the difference is that I want to find 2 words in the same sentence. I need ...
split a dataset in two sets of rows depending on specific column value [python, unix] Question: I have a data set with rows and columns saved as a tab-delimited text format. I would like to divide this data set into two smaller data sets depending on whether or not column[x] has a certain value. Here is an example of ...
pythonic equivalent this sed command Question: I have this awk/sed command awk '{full=full$0}END{print full;}' initial.xml | sed 's|</Product>|</Product>\ |g' > final.xml to break an XML doc containing large number of tags such that the new file will have all contents of the product node in a s...
Django: Get all model instances of top level category Question: I've got a heirarchy like so: Parent Cat Sub Cat Item Sub Cat Item Item Parent Cat ... Having the name/instance of a parent category I'd like to get all items which are r...
Numpy longdouble arithmetic does not seem to be in long double with conversion Question: I have been playing C99's [quad precision](http://en.wikipedia.org/wiki/Quadruple-precision_floating- point_format) long double. It is my understanding that (platform specific) numpy supports [long double](http://docs.scipy.org/doc...
Speed up sampling of kernel estimate Question: Here's a `MWE` of a much larger code I'm using. Basically, it performs a Monte Carlo integration over a KDE ([kernel density estimate](http://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.gaussian_kde.html)) for all values located below a certain threshold (the ...
Python "R Cut" function Question: I am wondering if there is a function in Python already written for the goal that I describe later. If not, what would be the easiest way to implement. My code is attached. Say I have a range from 1 to 999999999. Given a list of numbers like this: [9, 44, 99] It w...
Find Python module filename Question: I got module name which contains declaration of `os.path.isfile`. [Jedi](https://github.com/davidhalter/jedi) lib gave me `genericpath` (without file path). Now i want to get full filename of PY file with this `genericpath` module. E.g. "C:\Py27\Lib\genericpath.py". How can I do it...
How would I create a Python web server that downloads a file on any GET request? Question: I am attempting to create an easy solution to file sharing across computers in my local network. I used to execute `python -m SimpleHTTPServer` in bash whenever I wanted to share a directory, but I wanted a way to share only one ...
how to count the repetition of the elements in a list python, django Question: I have a django app, i am using `django-taggit` for my blog. Now i have a list of elements(In fact objects) that i got from database in one of my view as below tags = [<Tag: some>, <Tag: here>, <Tag: tags>, <Tag: some>, <Tag:...
Python Tkinter OptionMenu command Exception Question: I want to create a tkinter `OptionMenu` that edits another `OptionMenu` when it's changed. So I tried to create a `command=` argument which makes a specific command run on every update of the `OptionMenu`, like it does when I pass the command-Argument to a button, s...
python find the 2nd highest element Question: 1.In a given array how to find the 2nd or 3rd,4th ,5th values. 2.Also if we use max() function in python what is the order of complexity i.e, associated with this function max() def nth_largest(li,n): li.remove(max(li)) print max(ele) //...
Any way to bypass namedtuple 255 arguments limitation? Question: I'm using a namedtuple to hold sets of strings and their corresponding values. I'm not using a dictionary, because I want the strings accessible as attributes. Here's my code: from collections import namedtuple # Shortened fo...
Pack labels right next to entry box in tkinter python Question: I have a window that prompts users to enter the directory of their log files. However, my label seems to pack on top of my entrybox. Any idea on how to pack them side by side? labelText=StringVar() labelText.set("Enter directory of ...
converting a float to decimal type in Python Question: I have an array that grows with each iteration of a loop: for i in range(100): frac[i] = some fraction between 0 and 1 with many decimal places This all works fine. When I check the **type(frac[i])** , I am told that it is **'numpy.floa...
Why are my App tests not being recognized by Django tests? Question: ## Background: I have the following django project setup: >TopLevel: > - App1: > * models.py > * forms.py > * views.py > * __init__.py > * Tests/ > * __init__.py > ...
Find all the contents between two tags in python Question: <p>This is the first paragraph with some details</p> <p><a href = "user123">user1</a><font>This is opening contents for user1</font></p> <p><font>This is the contents from user1</font></p> <font><p>This is more content from user1</p></font> ...
global var becomes local --UnboundLocalError: local variable referenced before assignment Question: I initialized `rate` as a global var: import os, sys rate=30 def foo(): print('#########rate:', rate) if False: rate=int(sys.argv[2]) foo() but ...
Add a service in Mac Finder using CLI Question: I write a Python script and I want to add it as a service item in Mac Finder. I know I can open `Automator` window and set it. But I need a command line way. I search the method for a long time and still get nothing... Do anyone know how to achieve this? Thanks a lot. (U...
What's the best way to search a number and replace it after calculation in a string by Python? Question: For example. I have a string: "[bezierPath moveToPoint: CGPointMake(7.98, 6.11)];". I want to do some calculation on the two float number and replace them. Answer: You can use `re.sub`: >>> import r...
enforce column encoding with sqlalchemy Question: I am using sqlalchemy to create the schema of my database. I have no success in enforcing the use of utf-8, no matter what I tried. Here is a minimal python script that recreates my problem: from sqlalchemy import create_engine, Column, Unicode from ...
OpenCV Python can't use SURF, SIFT Question: I'm trying a simple thing like detector = cv2.SIFT() and get this bad error detector = cv2.SIFT() AttributeError: 'module' object has no attribute 'SIFT' I do not understand that because cv2 is installed. cv2.**version** is ...
python, tkinter: Using grid layout, my frame refuses to display its contents Question: Trying to use grid geometry instead of pack(), but using a frame without use of pack() has me lost. All I Want is a frame around it so that I can have a border and label around certain sections. I suspect the width and height paramet...
Python 2.7 not searching folders inside of site-packages Question: I'm running Windows 7 x64. I've installed Python 2.7 32-bit into the default directory (C:/Python27). I used Pip to install a few modules (e.g. social-auth), but when I try to import them, Python says there is no module with that name. For example, "im...
Python can't authenticate with ntlm Question: I am trying to parse a site on my intranet and when authenticating as below I get an error saying that authentication is required, which I have already done. Why am I still getting this 401 error? Thanks in advance! > File "C:\Python27\lib\urllib2.py", line 531, in http_e...
Writing bytes to file, bad encoding Question: I have a problem in Python 3.x with writing to file, write function in FOR is writing czech signs in utf-8 coding. I am new in Python but i set up IDE and .py, .xml files for 'utf-8' encoding and i have no idea why is output file looking like that. My code: -...
Python sort a list by two values Question: I'm trying to sort this list first by name in reverse. Then, after the first set of results (where flag = "ZAR"), I want to sort the remaining elements by time not in reverse: import operator list = [ {"flag":"ZAR", "time":"17:45"}, {"flag":"...
Flask-Superadmin - 'module' object has no attribute 'FileField' Question: I'm tring to launch simple code from the docs: <https://flask-superadmin.readthedocs.org/en/latest/quickstart.html> Here is the code: from flask import Flask from flask.ext.superadmin import Admin app = Flask(__name_...
pygame and python not working for me Question: I'm just starting out with pygame and I'm have a bit of an issue, here is my code... import pygame, sys from pygame.locals import * pygame.init() DISPLAYSURF = pygame.display.set_mode((400, 300)) pygame.display.set_caption('Hello World!') while ...
what is similar function to epoll's unregister function for kqueue? Question: Python Epoll has function called epoll.unregister which removes a registered file descriptor from the epoll object. Does any one know what is the function in Kqueue which is similar this. For kqueue I could only find how to delete events. A...
Count how many times a dictionary value is found with more than one key Question: I'm working in python. Is there a way to count how many times values in a dictionary are found with more than one key, and then return a count? So if for example I had 50 values and I ran a script to do this, I would get a count that wou...
Python, install .pyd file: ImportError: DLL load failed Question: I am trying to install the PyLZJB.pyd file from here: https://code.google.com/p/pylzjb/downloads/list I have downloaded the file and placed it in my Python27/DLLs folder where I also see some other .pyd files. I am on Windows. I ha...
ImportError: No module named mpl_toolkits with maptlotlib 1.3.0 and py2exe Question: I can't figure out how to be able to package this via py2exe now: I am running the command: python setup2.py py2exe via python 2.7.5 and matplotlib 1.3.0 and py2exe 0.6.9 and 0.6.10dev This worked with matplotlib...
TF-IDF in python and not desired results Question: I found a python tutorial on the web for calculating tf-idf and cosine similarity. I am trying to play with it and change it a bit. The problem is that I have weird results and almost without any sense. For example I am using 3 documents. `[doc1,doc2,doc3]` doc1 and ...
python multicore queue randomly hangs for no reason, despite queue size being tiny Question: in python here is my multiprocessing setup. I subclassed the Process method and gave it a queue and some other fields for pickling/data purposes. This strategy works about 95% of the time, the other 5% for an unknown reason th...
Is there any way I can import the python 3 version of 'bytes' into python 2? Question: I am writing python code and I want to support python 2 and 3. One of the most prominent data types I'm dealing with is immutable sequences of bytes, so I want to find an elegant way to deal with the disparity between python 2 'bytes...
matplotlib bar3d clipping problems Question: I am trying to create a 3D bar graph with Matplotlib 1.2.0 and Python 2.7.3. I followed the advice in <http://www.mail-archive.com/matplotlib- users@lists.sourceforge.net/msg19740.html> and plotted the bar one by one, but I am still getting rendering problems (i.e., bars on ...
Solve sparse upper triangular system Question: I'm trying to figure out how to efficiently solve a sparse triangular system, Au*x = b in scipy sparse. For example, we can construct a sparse upper triangular matrix, Au, and a right hand side b with: import scipy.sparse as sp import scipy.sparse.linal...
Progress indicator during pandas operations (python) Question: I regularly perform pandas operations on data frames in excess of 15 million or so rows and I'd love to have access to a progress indicator for particular operations. Does a text based progress indicator for pandas split-apply-combine operations exist? Fo...
Sorting and Organization of letter frequency - python Question: I'm trying to find a way to count the number of occurrences of letters in a text file than display them in greatest to lowest depending upon there frequency. This is what I have so far, please help get over this brain block. def me(): ...
Python interactive shell running copy.py on current directory? Question: I have a script named `copy.py` on my current directory with the following content: #!/usr/bin/env python3 print("Ahoy, matey!") If I run Python interactive shell and do some action which raise an exception (e.g. refe...
Python: How to time script from beginning to end? Question: I've created a script which processes files and returns the size of each file in bytes. The time it takes is dependent on how large the directory is that you scan. At the top of my script, I placed in: now = "\n", strftime("%Y-%m-%d %H:%M:%S", ...
Subscribe and unsubscribe to channels after the connection has been made with txredisapi Question: Working with Python, Twisted, Redis and txredisapi. How can I get the SubscriberProtocol for subscribe and unsubscribe to channels after the connection has been made? I guess I need to get the instance of the Subscriber...
Looking for an algorithm to count the number of possible patterns Question: I need your help in constructing an algorithm to solve the following problem: `A 5x5 table can be filled with the values ​​0 and 1 so that each line and each column of the table consists of exactly two ones and three zeros. How many solutions ...
printing long string with a single write call Question: I found a quite unexpected feature(or bug ?) when trying to write a long string with a single `write` call using python (python 2.7.3-32 bit, windows 7). Calling `print "a"*4000` prints on stdout a line that seems ok but calling `print "a"*5000` just produces a l...
python threading : cannot switch thread to Daemon Question: I would expect next code to be executed simultaneously and all filenames from os.walk iterations , that got 0 at random , will get in result dictionary. And all threads that have some timeout would get into deamon mode and will be killed as soon as script reac...
python: checking for errors in the users input Question: I would like to check if a string can be a float before I attempt to convert it to a float. This way, if the string is not float, we can print an error message and exit instead of crashing the program. so when the user inputs something, I wanna see if its a float so...
Python bottle accept data send by jquery Question: I'm using Python bottle, html/css, and Javascript to develop a website. Now in the Javascript part, I want to send a list data to the back end Python using Jquery: $.ajax({ type: "POST", url: '/deleteauthor', ...
Downloading files from an HTTP that looks like a FTP Question: Thinking that I was dealing with a ftp site, I tried to login to e4ftl01.cr.usgs.gov/ using this Python simple script: import ftplib ftp = ftolib.FTP("e4ftl01.cr.usgs.gov") ftp.login() I got this error: socket.err...
Segmentation fault: 11 when importing math into Python Question: It crashes everytime I try to import from math. Is there a way to reinstall the math library? I'm on Python 3.3.2. sidwyn$ python3 >>> from math import pi Segmentation fault: 11 Answer: Please try this: $ env -...
How can I programmatically change the argspec of a function *not* in a python decorator? Question: Very closely related to: [How can I programmatically change the argspec of a function in a python decorator?](http://stackoverflow.com/questions/3729378/how-can-i- programmatically-change-the-argspec-of-a-function-in-a-py...
Calculator in python problems Question: I made a calculator in python import time print("Calculator 1.0") print("made by AnAwesomeMiner") print("Number 1 in calculation") x = input() print("Number 2") y = input() print("calculating") time.sleep(3) print("why is this no...
Mining pdf Data with python through clipboard - Python Scripting the OS Question: I have written a script that extracts data from pdf. I am using the win32clipboard module to copy the the data into python. Got the logic working on how to get the data I need in each file. The shortcoming of my process is that I have to...
Execute in fabric run('hg pull') Question: I'm developing some Django application on Windows host computer. I've created fabfile with tasks. In one of my steps I execute something like that: local("hg pull") local("hg update") and it works properly. In other task I try to execute on remote mac...
Scraping and stripping off child tags python Question: I have following code structure from a website I wanna scrape. <span class="blk">Society/Project: <b>Sai Sparsh</b></span> <i class="blk"> Built-up Area: <b>1005 Sq.Ft.</b> @ <i class="WebRupeesmall b mr_5 f1...
how to have a web.py python webservice return a jsonp call to jquery Question: **So I'm trying to get a web.py based python webservice to send back a list object trough JSONP after jQuery makes an ajax call to it.** Problem is after reading up a lot of examples I'm still failing to understand how to make it work. Here...
Does selenium python bindings require firefox Question: Hi I just downloaded and installed selenium but, I can't figure out how to get it working I am using the following example as a test.... from selenium import webdriver from selenium.webdriver.common.keys import Keys driver = webdriver.F...
Can't create new threads in Python Question: import threading threads = [] for n in range(0, 60000): t = threading.Thread(target=function,args=(x, n)) t.start() threads.append(t) for t in threads: t.join() It is working well for range up to 800 on my laptop, b...
Sublime Text 2 - SublimeREPL - key bindings for eval file stopped working Question: On mac osx 10.8.4. Sublime Text 2.0.2 My python interpreter invoked through Tools -> SublimeREPL -> Python -> Python Run current file will run the file that I wish it to run without issue. However, when I invoke Tools -> SublimeREPL ->...
How to make Pacman's ghost randomly move around in Python? Question: How do I make a ghost in Pacman move around randomly? I figured out how to move your own player. I tried using the random.randiant command but instead it kept coming up with a blank screen. I tried bliting all the images but it still keeps coming up w...
TypeError: 'module' object is not callable when importing glob in Eclipse Question: I am working with Eclipse Kepler(2013) and python 3.3.2 and running a simple import like import glob a = glob.glob('*') print(a) gives a: TypeError: 'module' object is not callable This ...
wxPython EVT_CHAR not called when a panel is added to a frame Question: I need to bind the EVT_CHAR event for a GUI application I am developing using wxPython. I tried the following and I cann understand the beahviour of the code. import wx import wx.lib.agw.flatnotebook as fnb class DemoApp...