Web Development
int64
0
1
Data Science and Machine Learning
int64
0
1
Question
stringlengths
35
6.31k
is_accepted
bool
2 classes
Q_Id
int64
5.14k
40.5M
Score
float64
-1
1.2
Other
int64
0
1
Database and SQL
int64
0
1
Users Score
int64
-6
163
Answer
stringlengths
19
4.91k
Python Basics and Environment
int64
0
1
ViewCount
int64
12
475k
System Administration and DevOps
int64
0
1
Q_Score
int64
0
346
CreationDate
stringlengths
23
23
Tags
stringlengths
6
68
Title
stringlengths
12
138
Networking and APIs
int64
0
1
Available Count
int64
1
31
AnswerCount
int64
1
35
A_Id
int64
5.3k
72.3M
GUI and Desktop Applications
int64
1
1
0
0
I'm developing a game and now I want to make script system for it. Now I have abstract class Object which is inherited by all game objects. I have to write a lot of technical code, add new object type into enum, register parser function for each object (that function parses object's params from file). I don't want to make such work. So the idea is to get some script system (boost.python for example, because I'm using boost in my project). Each object will be a simple python-script, at c++ side I just load and run all that scripts. Python isn't hard -typed so I can register functions, build types dynamically without storing enum, etc. The only bad part is writing a lot of binding-code but It makes only once. Are my ideas right?
true
5,050,372
1.2
1
0
0
Can you give us a rough idea of how large the game is going to be? If you're not careful, you could give yourself a lot of extra work without much benefit, but with some planning it sounds like it might help. The important questions are "What parts of the program do I want to simplify?", "Do I need a scripting language to simplify them? and "Can the scripting language simplify them?". You mentioned that you don't want to have to manually parse files. Python's pickle module could handle serialization for you, but so could .NET. If you're using Visual Studio, then you may find it easier to write the code in C# than in Python. You should also look for ways to simplify your code without adding a new language. For example, you might be able to create a simple binary file format and store your data structures without much parsing. There are probably other things you can do, but that would require more detailed knowledge of the program.
1
203
0
1
2011-02-19T10:57:00.000
c++,python,boost,system
Script system in application
0
1
1
5,055,236
1
0
0
I'm having a problem with a simple Notepad application I'm writing to teach myself basic Python/PyQt. Specifically, I want to know how to change the multi-touch pan gesture sensitivity on a QListWidget. As it is now, when I drag up and down with 2 fingers, it seems like the list is moving up/down one step for each pixel I move with my fingers. This is nothing I've implemented myself, it seems to work out of the box for list widgets I want the movement to mimic the speed of my fingers i.e one move up/down of the widget items for every x*height_of_item_in_pixels. Is this doable without major hacking into the gesture system? How would I go about this? I'm using PyQt 4.8.3 with Python 2.6
false
5,050,817
0
0
0
0
More than likely this functionality exists because the multitouch event is being interpreted by your operating system as a scroll of some type and QT is recieving the scroll action, rather than the multitouch action directly.
0
1,586
0
3
2011-02-19T12:40:00.000
python,qt4,pyqt,pyqt4,qlistwidget
Customize PyQt multi-touch pan gestures on QListWidget
0
1
2
18,070,801
1
0
0
How can i make a smooth circular orbit at a constant speed using pygame? How would i calculate x, y on a circle?
false
5,058,591
0.099668
0
0
1
Try using polar coordinates. It's natural :) If you don't calculate enough frames to make your orbit look smooth, calculate 3-4 intermediate points of orbit to draw shorter line segments, without calculating the game state at these points. Make this radius-dependent. This helps proper collision detection, too.
0
907
0
1
2011-02-20T17:16:00.000
python,math,pygame
Making smooth orbits in pygame
0
1
2
5,058,696
1
0
0
I have a little programming experience and I did get to work with Swing (Java) and wxPython. Some years ago, I ended up having to port an app I did to OS X and all the problems I've had with wxPython just multiplied. I've started looking at alternatives and I could not find anything better than wxPython. QT was the only one that came even close. GTK was hell on Windows (last time I checked). I don't think my predicament is unique, some other people might have reached the same position over the years. So, why isn't there a GUI toolkit to have the following characteristics: Simple. Basic windows/dialogs (native open and save) + a basic set of widgets with SOLID Layout management. Additional (composite widgets) implemented as additional libraries. Actively maintained on OS X, Linux and Windows Actively maintained bindings to at least 3 high level languages. Actively maintained documentation for best practices GUI devel with examples using the toolkit. MVC/MVP properly explained. GUI HIG (Apple style) simply explained, complete with semantics, paradigms, best practices, alignment, proper spacing and TONS of best of their kind examples from successful pieces of software. A simple way of building a distributable executable for the 3 targeted platforms in each of the languages. Implemented as close to the metal using readily available libs like Clutter, cairo, etc. Are these requirements too much to ask? If yes, why? Help me understand why isn't there such a tiny lib available?
false
5,067,578
0.16514
0
0
5
Have you tried Qt? It is a cross platform C++ GUI toolkit for higher level language (PyQt). And it seemed very simple to me.
0
653
0
2
2011-02-21T15:08:00.000
python,user-interface
Why are there no simple, cross-platform, C/C++ GUI tookits for higher level languages?
0
3
6
5,067,597
1
0
0
I have a little programming experience and I did get to work with Swing (Java) and wxPython. Some years ago, I ended up having to port an app I did to OS X and all the problems I've had with wxPython just multiplied. I've started looking at alternatives and I could not find anything better than wxPython. QT was the only one that came even close. GTK was hell on Windows (last time I checked). I don't think my predicament is unique, some other people might have reached the same position over the years. So, why isn't there a GUI toolkit to have the following characteristics: Simple. Basic windows/dialogs (native open and save) + a basic set of widgets with SOLID Layout management. Additional (composite widgets) implemented as additional libraries. Actively maintained on OS X, Linux and Windows Actively maintained bindings to at least 3 high level languages. Actively maintained documentation for best practices GUI devel with examples using the toolkit. MVC/MVP properly explained. GUI HIG (Apple style) simply explained, complete with semantics, paradigms, best practices, alignment, proper spacing and TONS of best of their kind examples from successful pieces of software. A simple way of building a distributable executable for the 3 targeted platforms in each of the languages. Implemented as close to the metal using readily available libs like Clutter, cairo, etc. Are these requirements too much to ask? If yes, why? Help me understand why isn't there such a tiny lib available?
false
5,067,578
0
0
0
0
My guess is that windows developers couldn't be bothered as they have wpf etc and linux developers couldn't be bothered as they are used to it. So only people who are sick of win developement and moving to linux would embrace it. Maybe its time for you to start an open source project :) I was thinking something like wpf but based on opengl would be a good start.
0
653
0
2
2011-02-21T15:08:00.000
python,user-interface
Why are there no simple, cross-platform, C/C++ GUI tookits for higher level languages?
0
3
6
5,067,655
1
0
0
I have a little programming experience and I did get to work with Swing (Java) and wxPython. Some years ago, I ended up having to port an app I did to OS X and all the problems I've had with wxPython just multiplied. I've started looking at alternatives and I could not find anything better than wxPython. QT was the only one that came even close. GTK was hell on Windows (last time I checked). I don't think my predicament is unique, some other people might have reached the same position over the years. So, why isn't there a GUI toolkit to have the following characteristics: Simple. Basic windows/dialogs (native open and save) + a basic set of widgets with SOLID Layout management. Additional (composite widgets) implemented as additional libraries. Actively maintained on OS X, Linux and Windows Actively maintained bindings to at least 3 high level languages. Actively maintained documentation for best practices GUI devel with examples using the toolkit. MVC/MVP properly explained. GUI HIG (Apple style) simply explained, complete with semantics, paradigms, best practices, alignment, proper spacing and TONS of best of their kind examples from successful pieces of software. A simple way of building a distributable executable for the 3 targeted platforms in each of the languages. Implemented as close to the metal using readily available libs like Clutter, cairo, etc. Are these requirements too much to ask? If yes, why? Help me understand why isn't there such a tiny lib available?
false
5,067,578
0.066568
0
0
2
What you ask is a simple lib with enormous flexibility. Be able to build 3 * 3 executables, having good documentation and using other libraries all with a different background. And all of that on different OS platforms. It is quite a challenge it think QT would com the closest but it does not meet all your criteria.
0
653
0
2
2011-02-21T15:08:00.000
python,user-interface
Why are there no simple, cross-platform, C/C++ GUI tookits for higher level languages?
0
3
6
5,067,669
1
0
0
How do I make a newly created window in wxPython not take focus? I'd like to be able to create a new window, without focus jumping to it.
false
5,073,054
0.099668
0
0
1
That seems a little counter-intuitive. However, you can also simulate this by creating and showing the second frame and then calling Raise() on the original frame.
0
527
0
2
2011-02-22T01:06:00.000
python,wxpython,focus
Preventing New Windows from Capturing Focus wxPython
0
1
2
5,082,357
1
0
0
Is it possible to convert a QTabBar inside the QTabWidget into a QComboBox?
true
5,075,232
1.2
0
0
1
That might somehow be possible by overwriting QTabWidget, but I think the much cleaner, faster and easier solution would be to combine QComboBox and QStackedWidget to a new widget.
1
161
0
1
2011-02-22T07:23:00.000
python,qt,pyqt,pyqt4
Is it possible to convert a QTabBar inside the QTabWidget into a QComboBox?
0
1
1
5,077,111
1
0
0
I've installed ActivePython 3.1 and ran IDLE with -n parameter as required by the turtle module in documentation. However when I try to use it with call such as turtle.postion(), new windows is opened (with Tk icon), which freezes and shows nothing. What could be wrong?
false
5,081,499
0.197375
0
0
2
The immediate cause of the freeze is that the Tk event loop is not being serviced. Without that, Tk windows do not display or update correctly (all GUI toolkits are event based, but Tk is particularly so). Unfortunately, I don't know Python's Tk binding or IDLE nearly well enough to be able to say what that is caused by.
0
906
0
2
2011-02-22T17:19:00.000
python,windows,tk,turtle-graphics,activepython
Why ActivePython freezes after I use the turtle module?
0
2
2
5,137,220
1
0
0
I've installed ActivePython 3.1 and ran IDLE with -n parameter as required by the turtle module in documentation. However when I try to use it with call such as turtle.postion(), new windows is opened (with Tk icon), which freezes and shows nothing. What could be wrong?
false
5,081,499
0
0
0
0
Partially resolved by not running it in IDLE, I execute it as a python script and wait for input to see what is drawn.
0
906
0
2
2011-02-22T17:19:00.000
python,windows,tk,turtle-graphics,activepython
Why ActivePython freezes after I use the turtle module?
0
2
2
5,092,475
1
0
0
I'm using Python Tkinter and I want to place a variable number of text box widgets in a frame or canvas. The text boxes are packed vertically down the frame, so the first one is on top, the second one is found below, etc.. I can have all the button, listbox, etc widgets in a "left section" of the GUI, while a "right section" will only contain the text box widgets. I want the text box widgets to horizontally expand when the master window is maximized, but because there's a variable number of these widgets, the "right section" containing the text boxes also needs to be able to vertically scroll to view them all. Currently, I'm using Canvas.create_window to add my variable number of text boxes to the canvas, and while I can scroll the canvas to view all the text boxes, they do not horizontally expand when I resize the window. I have an alternate GUI that uses a frame for the "right section", which allows the widgets to horizontally expand, but if too many are packed, I cannot scroll the frame to see the additional text boxes because I can't have a scroll bar tied to a frame. Is there any way around this trade-off?
true
5,082,642
1.2
0
0
0
The solution is pretty simple: bind to the <Configure> event of the canvas -- this will cause your callback to be called whenever the canvas widget is resized. You then simply need to get the width of the canvas and use that to iteratively resize all the embedded windows.
0
1,473
0
1
2011-02-22T19:03:00.000
python,canvas,widget,scroll,tkinter
Python Tkinter - Scrollable canvas containing expandable widgets
0
1
1
5,082,704
1
0
0
I'm wondering how to go about implementing a macro recorder for a python gui (probably PyQt, but ideally agnostic). Something much like in Excel but instead of getting VB macros, it would create python code. Previously I made something for Tkinter where all callbacks pass through a single class that logged actions. Unfortunately my class doing the logging was a bit ugly and I'm looking for a nicer one. While this did make a nice separation of the gui from the rest of the code, it seems to be unusual in terms of the usual signals/slots wiring. Is there a better way? The intention is that a user can work their way through a data analysis procedure in a graphical interface, seeing the effect of their decisions. Later the recorded procedure could be applied to other data with minor modification and without needing the start up the gui.
false
5,093,153
0.066568
0
0
1
Thinking in high level, this is what I'd do: Develop a decorator function, with which I'd decorate every event-handling functions. This decorator functions would take note of thee function called, and its parameters (and possibly returning values) in a unified data-structure - taking care, on this data structure, to mark Widget and Control instances as a special type of object. That is because in other runs these widgets won't be the same instances - ah, you can't even serialize a toolkit widget instances, be it Qt or otherwise. When the time comes to play a macro, you fill-in the gaps replacing the widget-representating object with the instances of the actually running objects, and simply call the original functions with the remaining parameters. In toolkits that have an specialized "event" parameter that is passed down to event-handling functions, you will have to take care of serializing and de-serializing this event as well. I hope this can help. I could come up with some proof of concept code for that (although I am in a mood to use tkinter today - would have to read a lot to come up with a Qt4 example).
0
1,816
0
2
2011-02-23T15:41:00.000
python,user-interface,macros,recorder
Implementing a macro recorder for a python gui?
0
2
3
5,093,338
1
0
0
I'm wondering how to go about implementing a macro recorder for a python gui (probably PyQt, but ideally agnostic). Something much like in Excel but instead of getting VB macros, it would create python code. Previously I made something for Tkinter where all callbacks pass through a single class that logged actions. Unfortunately my class doing the logging was a bit ugly and I'm looking for a nicer one. While this did make a nice separation of the gui from the rest of the code, it seems to be unusual in terms of the usual signals/slots wiring. Is there a better way? The intention is that a user can work their way through a data analysis procedure in a graphical interface, seeing the effect of their decisions. Later the recorded procedure could be applied to other data with minor modification and without needing the start up the gui.
false
5,093,153
0.066568
0
0
1
You could apply the command design pattern: when your user executes an action, generate a command that represents the changes required. You then implement some sort of command pipeline that executes the commands themselves, most likely just calling the methods you already have. Once the commands are executed, you can serialize them or take note of them the way you want and load the series of commands when you need to re-execute the procedure.
0
1,816
0
2
2011-02-23T15:41:00.000
python,user-interface,macros,recorder
Implementing a macro recorder for a python gui?
0
2
3
5,093,408
1
0
0
So I've got a problem - I'm writing a game prototype in Python, using Pygame, and I want to save my games. All of the game-related data is in three instances of certain classes, and I want to save these three instances to a file. However, I've tried pickling these instances, and it doesn't work. Instead, I get "TypeError: can't pickle Surface objects". This is a problem, because I want to store Surface objects. I'm open to any alternatives to pickling that there may be, using any other kind of data type. The important thing is that these instances get stored, and that their data is then retrievable later on. So what can I do to overcome this issue? Please keep in mind, I'm not a very experienced programmer, having learned Python in my spare time a year ago, and I can't write much of any other language, though I'm slowly learning C++.
false
5,145,664
0.462117
0
0
5
The basic point of pickling is that you should be able to serialise the object somehow. An SDL surface is an in memory object holding a lot of run time state. Trying to serialise it is not totally sensible. What you should do is to decouple the state of your game from the rendering components so that you can serialise just those (pickling or whatever). It's like trying to save the state of a video by somehow saving the memory buffers holding the decoded video. This will not work. Instead, how you save it is to serialise the location of the video file and the time offset. Then you can continue playback upon load the next time you restore your application.
1
1,353
0
3
2011-02-28T17:58:00.000
python,serialization,pygame,pickle
Storing unpicklabe pygame.Surface objects in external files
0
1
2
5,145,756
1
0
0
I started using SWIG on a huge C++ library (made of of several inter-dependent static libs) to expose it to python. This library defines many primitive classes that are used throughout as parameters (images of different types for example). There is extensive use of STL, inheritance and templating in the lib as well. So far I have a minimal portion of the lib usable from Python but would like to progressively add the remaining 90+%. For my part, working with SWIG is really no fun: Battling with template instantiations, learning all that SWIG syntax and keywords, etc. I recently played a bit with CTypes and found it so enjoyable that I am now considering writing an extern C interface for the whole library instead of using SWIG. I would rather be coding in C/C++ and/or Python than learning an obscure set of SWIG commands (that counts for SIP also). There are quite a few questions out there already asking similar advice so I'll add something new and specific: I would like for the library's internal images classes to be visible from python as PIL images transparently, not as SWIG-Wrapped native classes. Will I have to resort to the plain-old Python External API to accomplish that? I welcome any and all advice!
false
5,160,308
0.197375
1
0
1
Have you considered looking into using Boost.Python?
0
982
0
3
2011-03-01T21:03:00.000
c++,python,python-imaging-library
Exposing C++ library to Python + PIL
0
1
1
5,161,325
1
0
0
Why doesn't Ctrl+C work to break a Python program that uses PyQt? I want to debug it and get a stack trace and for some reason, this is harder to do than with C++!
false
5,160,577
0.379949
0
0
4
I agree with Neil G, and would add this: If you do not call QApplication.exec_() to start the event loop, and instead execute your program in an interactive python shell (using python -i), then pyqt will automatically process events whenever the interactive prompt is waiting, and Ctrl-C should again behave as expected. This is because the Qt event loop will be sharing time with the python interpreter, rather than running exclusively, allowing the interpreter a chance to catch those interrupts.
0
10,443
0
23
2011-03-01T21:28:00.000
python,pyqt
Ctrl-C doesn't work with PyQt
0
1
2
5,186,213
1
0
0
I have a list of instances of objects (wxPython widgets). I'd like to be able to tell if an instance within my list has been destroyed. How would one go about this?
true
5,162,773
1.2
0
0
4
Assuming wxPython is playing by the rules and by "destroyed" you mean "is no longer referenced", then the weakref module in the standard library should let you do what you want (specifically, you can register a callback when creating a weak reference that is invoked just before the target of the weak reference is destroyed). If wxPython isn't playing by the rules, or has disabled weak referencing for its objects, you may be out of luck.
1
803
0
1
2011-03-02T02:28:00.000
python,list,wxpython,instance
Telling if an Instance has been Destroyed
0
2
3
5,162,963
1
0
0
I have a list of instances of objects (wxPython widgets). I'd like to be able to tell if an instance within my list has been destroyed. How would one go about this?
false
5,162,773
0
0
0
0
This is applicable to all wx.Window derived objects. If it has been destroyed or disposed, it won't be None, but it will be False.
1
803
0
1
2011-03-02T02:28:00.000
python,list,wxpython,instance
Telling if an Instance has been Destroyed
0
2
3
40,513,866
1
0
0
When I try to import the 'Rect'-struct from System.Windows, IronPython-Interpreter claims that it cannot import. Since I am using the IronPython Tools for Visual Studio, i can also see that the IntelliSense-DropDown does not show this struct. Is there a need for a special statement for importing this struct? Thanks!
false
5,189,630
0.379949
0
0
2
You probably need to do: import clr clr.AddReference('WindowsBase') to load the assembly Rect is declared in before importing it.
1
273
0
1
2011-03-04T04:23:00.000
import,ironpython,rect
IronPython: Cannot import 'Rect'-struct from System.Windows
0
1
1
5,190,602
1
0
0
Is there an equivalent to Tkinter's .after() in wxPython? For those that don't know .after() allows the running of functions at some point in the future. This can be used to make loops with functions. I'm attempting to make a clock, so this would be handy for making it tick.
false
5,201,876
0.099668
0
0
1
There are several functions in wx.Python to do that. You should check the "Process and events" section of the wxPython demos, More especifically those related with wx.Timer The wx.Timer class allows you to execute code at specified intervals from within the wxPython event loop. Timers can be one-shot or repeating. This demo shows the principle method of using a timer (with events) as well as the convenient wx.FutureCall class.
1
1,132
0
1
2011-03-05T05:22:00.000
python,wxpython,tkinter
wxPython Equivalent to Tkinter .after()
0
1
2
5,201,931
1
0
0
i am looking to start learning. people have told me it is juts as capable. though i haven't really seen any good looking games available. some decent ones on pygame, but none really stand out. i would like to know if python really is as capable as other languages. EDIT: thanks guys, is python good for game development?
false
5,217,513
0.099668
0
0
2
Short answer: Yes, it is. But this heavily depends on your problem :)
1
161
0
0
2011-03-07T08:40:00.000
python
is python as capable as other languages like c++?
0
1
4
5,217,530
1
0
0
Im making a PyQt4 app which calls Imagemagick and ffmpeg, but it takes too much to complete the tasks and im wondering if there is a way to implement threads to this, the app is going to run in a multicore machine, and some of the methods I have seen are not efficient enough. Thanks in advance
true
5,224,679
1.2
0
0
0
The answer is yes and no - you can use QThread for threading but you'll still be subject to the GIL, so your threads will run in serial. You could try using multiprocessing to create a worker class in its own process and send work to it (or have it steal work from a queue), however this could introduce its own performance penalties in copying objects and sending objects between processes... Having re-read your question, it looks like Imagemagick and ffmpeg are external executables, in which case the GIL is released while you wait for the process to execute. Can I ask how you run these though? I tend to find that it is better to create a work queue and an event loop. Each time round the event loop you check whether your running process(es) have finished and then get their output. For this subprocess.Popen is more useful than os.command. If you use a QTimer you can utilise your QApplication's event loop, which also has the added benefit of allowing your GUI (assuming you have one) to be refreshed between ticks.
1
256
0
0
2011-03-07T20:08:00.000
multithreading,ffmpeg,imagemagick,pyqt4,python-2.6
Threads in PyQt4
0
1
1
5,273,687
1
0
0
i hear people say python is just as good as c++ and java but i cant find many good games made in python. a few in pygames but not many just trying to choose the right language edit: sorry, many games really, i would love to make a roguelike, basically my dream. also an overhead rpg. nothing to complex, i dont want to reinvent the wheel but i would like to make a fun game. i have minor java experience, but like the looks of python. i dont plan on making a 3d game really.
false
5,224,759
0.099668
0
0
3
I'd say Python is okay for scripting in a game engine (See: EVE Online, Civ IV), but I wouldn't write a game engine in it. The performance just isn't there for serious real-time games. If you just want to do simple 2d stuff that's fine, but your're not going to write the next Crysis, or even the next Minecraft, in pure Python.
1
90,954
0
21
2011-03-07T20:17:00.000
python
is python good for making games?
0
2
6
5,224,812
1
0
0
i hear people say python is just as good as c++ and java but i cant find many good games made in python. a few in pygames but not many just trying to choose the right language edit: sorry, many games really, i would love to make a roguelike, basically my dream. also an overhead rpg. nothing to complex, i dont want to reinvent the wheel but i would like to make a fun game. i have minor java experience, but like the looks of python. i dont plan on making a 3d game really.
false
5,224,759
0.033321
0
0
1
For the kind of games you want to make, Python is a perfectly suitable language. The only reason there are few games made in Python is because the professional game development industry nearly exclusively uses C++, which in turn due to a combination of performance concerns and reliance on legacy code. These aren't significant for your situation so don't worry about it.
1
90,954
0
21
2011-03-07T20:17:00.000
python
is python good for making games?
0
2
6
5,261,445
1
0
0
I'm trying to manage some Virtual Machines through the vboxapi provided with the SDK. So far I managed to launch the VM and poweroff it, but I'm not able to restore the snapshot. Looks like the power off procedure locks the virtual machine until the scripts terminates, as a matter of fact this is the error that I get: progress = self.session.console.restoreSnapshot(self.mach.currentSnapshot) File "", line 3, in restoreSnapshot xpcom.Exception: 0x80070005 (The object is not ready) And following is the specific functions I sequentially call to stop vm and restore snapshot. def stop(self): if self.mach: # Poweroff the virtual machine. progress = self.session.console.powerDown() # Wait for task to complete with a 60 seconds timeout. progress.waitForCompletion(VIRTUALBOX_TIMEOUT) # Check if poweroff was successful. if progress.resultCode != 0: log("[Virtual Machine] [PowerOff] [ERROR] Unable to poweroff virtual machine \"%s\"." % self.mach.name) return False else: log("[Virtual Machine] [PowerOff] Virtual machine \"%s\" powered off successfully." % self.mach.name) else: log("[Virtual Machine] [PowerOff] [ERROR] No virtual machine handle.") return False return True def restore_snapshot(self): if self.mach: # Restore virtual machine snapshot. progress = self.session.console.restoreSnapshot(self.mach.currentSnapshot) # Wait for task to complete with a 60 seconds timeout. progress.waitForCompletion(VIRTUALBOX_TIMEOUT) # Check if snapshot restoring was successful. if progress.resultCode != 0: log("[Virtual Machine] [Restore Snapshot] [ERROR] Unable to restore virtual machine \"%s\" snapshot." % self.mach.name) return False else: log("[Virtual Machine] [Restore Snapshot] Virtual machine \"%s\" successfully restored to current snashot." % self.mach.name) else: log("[Virtual Machine] [Restore Snapshot] [ERROR] No virtual machine handle.") return False return True I think I'm probably missing something, any clue of what that is? Thanks, C.
false
5,253,832
0
0
0
0
You need to lock the machine first so that the console object get created for you.
0
2,664
0
3
2011-03-09T23:53:00.000
python,api,virtualbox
VirtualBox Python API restoring snapshot
0
1
2
28,183,048
1
0
0
I'm trying to create a Listbox in Tkinter that has columns. I'm returning from a DB query records and would like to display each entry in it's own column for each record. Looking at Listbox, I feel like there should be this functionality there but can't find it. What widget should I be using to do this? I've been searching around online but documentation has been very sparse.
false
5,286,093
1
0
0
9
One simple solution is to use two listboxes side-by-side. There's no real magic, you just have to do a little bit of extra work to get one scrollbar to control both (easily done) and have the selection in the two sync up (also easily done).
0
62,004
0
20
2011-03-12T22:52:00.000
python,listbox,tkinter
Display Listbox with columns using Tkinter?
0
1
3
5,290,731
1
0
0
Is it possible to use both Cython and pure python extensions together? Say I'd like to have a wrapper for a C function, returning GdkPixbuf pointer. The ultimate goal would be to have that function available in python, returning gtk.gdk.Pixbuf object.
false
5,287,207
0
0
0
0
Yes it is possible because most of the things that can be done with python can also be done in cython. However, using python extensions or doing anything with python objects (as opposed to statically declared C datatypes) will incur a performance penalty, so Cython will be less of an advantage. Look into cdef classes, they are an efficient way to implement objects in cython.
1
272
0
0
2011-03-13T03:28:00.000
python,gtk,pygtk,cython
Cython interface with other extensions
0
1
1
5,467,143
1
0
0
I have a QTreeWidget with QComboBoxes inside of it. I would like to be able to hide the combo boxes. I am getting the QComboBox out of the tree using the itemWidget function. I have tried using setVisible(False) and hide() but neither work. Can anyone explain why this is the case and possibly offer a soultion? I suspect it has something to do with the QTreeWidget or the QTreeWidgetItems controlling the visibility of its widgets.
false
5,307,007
0
0
0
0
Have you tried putting the QComboBoxes inside a layout inside a QWidget, and placing the QWidget in the QTreeWidget?
0
220
0
1
2011-03-15T02:54:00.000
python,qt,user-interface,qt4,pyqt
PyQt Hide QDialogs Inside of QTreeWidget
0
1
1
5,312,332
1
0
0
I created three frames separately. I need to call these child frames from the click events of buttons located in a main frame. And when a child frame is open, I want the main frame to be hidden or disabled until the child frame is closed. How can I do this? Thanks in advance.
false
5,308,263
0
0
0
0
Create an event queue for each frame, when a child frame is opened set a variable that is checked on processing events to join the queue, and then unset this on destruction of the child frame. If this variable is set then throw the message away, otherwise add it to the queue for processing. Depending on the libraries you are using there may be a nice built-in way of dong most of this.
0
149
0
0
2011-03-15T06:31:00.000
python,wxpython
Control three frames from main menu
0
1
3
5,308,640
1
0
0
I'm trying to write some python, and I'm used to the lispy way of doing things, a REPL in EMACS and the ability to send arbitrary code snippets to the REPL. I like this way of developing code, and python's built-in IDLE seems to do it pretty well. However I do like EMACS as an editor. What's the best thing analogous to SLIME for Python? So far: It seems that the trick is to open a python file, and then to use 'Start Interpreter' from the Python menu, after which you get an Inferior Python buffer. You can then use C-c C-c to load the whole buffer you're editing into the 'REPL', and use normal copy and paste to put snippets into the REPL. This works as far as it goes. Is there any way to say 'reevaluate the big thing that the cursor is in now and display the answer', or 'reevaluate the thing the cursor is just at the end of and display the answer', like M-C-x and C-x-e in SLIME? And it all seems to work better if you use the python-mode.el from Bozhidar's answer
false
5,316,175
0.197375
0
0
3
python-mode is the default mode for editing Python in emacs. It includes commands for evaluating the buffer and running an inferior interpreter instance.
0
4,224
0
11
2011-03-15T18:18:00.000
python,emacs,slime
What's the closest thing to SLIME for python ? / What's the best way to use python from EMACS?
0
1
3
5,316,229
1
0
0
It might be the bindings (SIP) or even python, but I have a problem with Qt (pyqt4). I have a QTabWidget, and inside it I put widgets one can close. I have a widget that allocates about 400mb of memory. I have not set a parent, and I call deleteLater() on close but nothing happens. Even calling the python's gc does not work: import gc gc.collect() Now when closing the widgets from the QTabWidget without using deleteLater() more and more memory is allocated. So lets say I open up 4 tabs of the memory-heavy widget, I use around 1.6GB memory. If I close them all, and open a new, I am now up to 2GB of memory usage. If I use the deleteLater(), after closing the 4 tabs, I do not go up to 2GB opening a new one, then I have to open 5 tabs. But, and here is the problem, 1.6GB is still allocated for the process (python) even tho all widgets are closed, and deleteLater has been called. Thanks
true
5,341,954
1.2
0
0
3
I had this - somewhere you have an reference to your widget, and that reference has been counted... the only way to delete that widget is to make sure that there are no remaining references so python can garbage-collect it. At least you don't end up with a dangling reference like C++, which can lead to some nasty crashes... This can actually be useful - if you create a class with a class-level list of its members, you can recycle old objects and never have them garbage-collected
0
1,477
0
3
2011-03-17T16:19:00.000
python,qt,garbage-collection,pyqt4
Memory not deallocated - PyQt4
0
1
1
5,341,992
1
0
0
I've managed to package my PyQt4 app as a "standalone" application on windows, it works. However this application can upgrade itself, which is done by replacing the actual code written by me (.py files) with new versions, downloaded via the internet. How can I tell PyInstaller do its job (putting together the DLLs, generating the launcher with the shiny icon, etc), BUT let the .py files untouched? I need those files directly on disk, in order for the auto-update to work.
false
5,366,100
0
0
0
0
I think the embedded interpreter in the executable will still search for .py files in the same directory and/or PYTHONPATH, py2exe uses a zip file for native python components, iirc pyinstaller embeds all of them in the executable, maybe there is an option to keep a zip like in py2exe (or not add them in the spec), then try to run the application without the files and monitor file accesses with procmon.
1
1,782
0
8
2011-03-20T01:12:00.000
python,installation,pyqt4,pyinstaller
PyInstaller but keeping .py files upgradeable
0
1
4
6,085,674
1
0
0
I need to run a Qt application in Batch mode, so basically I need to run it without GUI. I've already tried using QCoreApplication but my application relies on the existence of X11 window. So I need the GUI to open regularly, but I need to "hide" it from the user. I know that I have the ability to create a virtual VNC and change the active display to the virtual VNC window. I'm looking for a cleaner, simpler solution that will allow to suppress or "dump" the GUI output of the application. If this helps for ideas, it will be used in a script written in Bash, Perl or Python.
false
5,369,290
0.197375
0
0
1
As @utdmr suggested, that solved the problem. I've thought that show() was also responsible for the signal/slot mechanism and other Qt and X11 functions. But apparently, the application works normally, just doesn't show the GUI. And that was exactly what I needed since it is a fully developed application and the effort to convert it to a console application was enormous. Thanks utdmr :)
0
454
0
2
2011-03-20T15:08:00.000
python,linux,qt,user-interface,x11
How to suppress a Qt GUI application?
0
1
1
5,420,016
1
0
0
I have a gtk.Window. How do I set it to be the active window? I can call is_active() to see whether it already is, but I don't see where to make it active. Bonus points: given a gtk.Widget, how do I make the window it is a part of the active window?
false
5,393,185
-0.049958
0
0
-1
You can also use gtk.Dialog.run (if it's a Dialog) aditional to gtk.Window.present
0
4,336
0
3
2011-03-22T14:58:00.000
python,window,pygtk,gtk
gtk: set active window
0
1
4
5,441,492
1
0
0
Debugging performance problems using a standard debugger is almost hopeless since the level of detail is too high. Other ways are using a profiler, but they seldom give me good information, especially when there is GUI and background threads involved, as I never know whether the user was actually waiting for the computer, or not. A different way is simply using Control + C and see where in the code it stops. What I really would like is to have Fast Forward, Play, Pause and Rewind functionality combined with some visual repressentation of the code. This means that I could set the code to run on Fast Forward until I navigate the GUI to the critical spot. Then I set the code to be run in slow mode, while I get some visual repressentation of, which lines of are being executed (possibly some kind of zoomed out view of the code). I could for example set the execution speed to something like 0.0001x. I believe that I would get a very good visualization this way of whether the problem is inside a specific module, or maybe in the communication between modules. Does this exist? My specific need is in Python, but I would be interested in seeing such functionality in any language.
false
5,416,987
0.066568
0
0
1
The methods you're describing, and many of the comments, seem to me to be relatively weak probabilistic attempts to understand the performance impact. Profilers do work perfectly well for GUIs and other idle-thread programs, though it takes a little practice to read them. I think your best bet is there, though -- learn to use the profiler better, that's what it's for. The specific use you describe would simply be to attach the profiler but don't record yet. Navigate the GUI to the point in question. Hit the profiler record button, do the action, and stop the recording. View the results. Fix. Do it again.
1
182
0
6
2011-03-24T09:19:00.000
java,python,performance,debugging,debuggervisualizer
Debugging visually using >>, >, >|, ||, |<, <, <<
0
2
3
5,419,956
1
0
0
Debugging performance problems using a standard debugger is almost hopeless since the level of detail is too high. Other ways are using a profiler, but they seldom give me good information, especially when there is GUI and background threads involved, as I never know whether the user was actually waiting for the computer, or not. A different way is simply using Control + C and see where in the code it stops. What I really would like is to have Fast Forward, Play, Pause and Rewind functionality combined with some visual repressentation of the code. This means that I could set the code to run on Fast Forward until I navigate the GUI to the critical spot. Then I set the code to be run in slow mode, while I get some visual repressentation of, which lines of are being executed (possibly some kind of zoomed out view of the code). I could for example set the execution speed to something like 0.0001x. I believe that I would get a very good visualization this way of whether the problem is inside a specific module, or maybe in the communication between modules. Does this exist? My specific need is in Python, but I would be interested in seeing such functionality in any language.
false
5,416,987
0.26052
0
0
4
The "Fast Forward to critical spot" function already exists in any debugger, it's called a "breakpoint". There are indeed debuggers that can slow down execution, but that will not help you debug performance problems, because it doesn't slow down the computer. The processor and disk and memory is still exactly as slow as before, all that happens is that the debugger inserts delays between each line of code. That means that every line of code suddenly take more or less the same time, which means that it hides any trace of where the performance problem is. The only way to find the performance problems is to record every call done in the application and how long it took. This is what a profiler does. Indeed, using a profiler is tricky, but there probably isn't a better option. In theory you could record every call and the timing of every call, and then play that back and forwards with a rewind, but that would use an astonishing amount of memory, and it wouldn't actually tell you anything more than a profiler does (indeed, it would tell you less, as it would miss certain types of performance problems). You should be able to, with the profiler, figure out what is taking a long time. Note that this can be both by certain function calls taking a long time because they do a lot of processing, or it can be system calls that take a long time becomes something (network/disk) is slow. Or it can be that a very fast call is called loads and loads of times. A profiler will help you figure this out. But it helps if you can turn the profiler on just at the critical section (reduces noise) and if you can run that critical section many times (improves accuracy).
1
182
0
6
2011-03-24T09:19:00.000
java,python,performance,debugging,debuggervisualizer
Debugging visually using >>, >, >|, ||, |<, <, <<
0
2
3
5,417,219
1
1
0
My stack for web developing includes Django/Python and Qt/C++ for non-web developing. What is most comfortable OS for a developer with such a stack ?
true
5,423,404
1.2
0
0
1
I would say: nobody cares...if you are fine with Windows, use Windows. If you are commandline guy, go with a Unix system...the distro unlikely matters...
0
237
0
1
2011-03-24T17:57:00.000
python,linux,qt
Which OS recommended for Programmers?
0
3
3
5,423,456
1
1
0
My stack for web developing includes Django/Python and Qt/C++ for non-web developing. What is most comfortable OS for a developer with such a stack ?
false
5,423,404
0.066568
0
0
1
Once you go linux, you'll never go back (though you might go crazy and move onto bsd). Ubuntu is probably the easiest OS to start with, if only because of the truckloads of documentation, forum assistance, etc. Good luck!
0
237
0
1
2011-03-24T17:57:00.000
python,linux,qt
Which OS recommended for Programmers?
0
3
3
5,423,449
1
1
0
My stack for web developing includes Django/Python and Qt/C++ for non-web developing. What is most comfortable OS for a developer with such a stack ?
false
5,423,404
0.066568
0
0
1
If you don't want to use an language that has special requirements (like .net), the question should be which os does the programmer recommend. That's really a personal decision.
0
237
0
1
2011-03-24T17:57:00.000
python,linux,qt
Which OS recommended for Programmers?
0
3
3
5,423,454
1
0
0
I need to know how to do this on a mac because whenever I try quitting it, I have to force quit it. Is there a proper way when the user clicks the exit button that Tkinter will exit normally?
false
5,427,875
0.379949
0
0
2
I figured out how. I just put a simple exit() command after the main loop.
0
888
0
2
2011-03-25T02:21:00.000
python,macos,tkinter,exit
Python: How can I make my tkinter app exit properly?
0
1
1
5,427,950
1
0
0
I am looking for a GUI toolkit which also has a good designer (like visual studio) for Python language. It should have ...Good Documentation ...Good IDE + Designer ...Cross Platform Support (if possible)
false
5,432,871
0
0
0
0
I've used PyQt together with Qt Designer, nice documentation and cross platform support.
1
1,203
0
3
2011-03-25T13:12:00.000
python,user-interface,toolkit
GUI Toolkit with Good Designer for Python
0
1
4
5,432,925
1
1
0
I am developing a 3d shooter game that I would like to run on Computers/Phones/Tablets and would like some help to choose which engine to use. I would like to write the application once and port it over to Android/iOS/windows/mac with ease. I would like to make the application streamable over the internet. The engine needs some physics(collision detection) as well as 3d rendering capabilities I would prefer to use a scripting language such as Javascript or Python to Java or C++(although I would be willing to learn these if it is the best option) -My desire is to use an engine that is Code-based and not GUI-based, an engine that is more like a library which I can import into my Python files(for instance) than an application which forces me to rely on its GUI to import assets and establish relationships between them. This desire stems from my recent experience with Unity3d and Blender. The way I had designed my code required me to write dozens of disorganized scripts to control various objects. I cannot help but think that if I had written my program in a series of python files that I would be able to do a neater, faster job. I'd appreciate any suggestions. The closest thing to what I want is Panda3d, but I had a difficult time working with textures, and I am not convinced that my application can be made easily available to mobile phone/device users. If there is a similar option that you can think about, I'd appreciate the tip.
true
5,445,166
1.2
0
0
2
For the requirements that you have Unity3d is probably one of your best bets. As roy said there aren't any other 3D engines out there that will span that wide a range of platforms. Why do you think that going to a completely code based system would save you from creating a variety of classes with various responsibilities ? The coding effort and the amount of code and classes will stay the same. The only thing that does change is the way that you interact with the system that you are producing. With any large scale system you will quickly run into hundreds of files. I am just finishing up a smaller sized unity project 3-4 month coding including learning unity it runs at 10k lines of code plus another 8k from external libraries and over 100 classes. But this amount wasn't driven by how unity works it was driven by the requirements of the project. While coding this I have learned a lot about how unity runs and what kind of patterns it requires and will be able to come up with better solutions for the next project. Look back at what you did and think about how you can organize it better. I think it is a save bet to say that you will need about the same amount of code with any other system to achieve a similar result. The advantages that unity does have are a good multiplattform support and a excellent asset pipeline. Importing and utilising art assets, 2D, 3D and audio is for me one of the most onerous tasks of this kind of development and it is extremely well supported in unity.
0
1,543
0
0
2011-03-26T20:41:00.000
javascript,python,game-engine
3d game engine suggestions
0
2
3
5,445,501
1
1
0
I am developing a 3d shooter game that I would like to run on Computers/Phones/Tablets and would like some help to choose which engine to use. I would like to write the application once and port it over to Android/iOS/windows/mac with ease. I would like to make the application streamable over the internet. The engine needs some physics(collision detection) as well as 3d rendering capabilities I would prefer to use a scripting language such as Javascript or Python to Java or C++(although I would be willing to learn these if it is the best option) -My desire is to use an engine that is Code-based and not GUI-based, an engine that is more like a library which I can import into my Python files(for instance) than an application which forces me to rely on its GUI to import assets and establish relationships between them. This desire stems from my recent experience with Unity3d and Blender. The way I had designed my code required me to write dozens of disorganized scripts to control various objects. I cannot help but think that if I had written my program in a series of python files that I would be able to do a neater, faster job. I'd appreciate any suggestions. The closest thing to what I want is Panda3d, but I had a difficult time working with textures, and I am not convinced that my application can be made easily available to mobile phone/device users. If there is a similar option that you can think about, I'd appreciate the tip.
false
5,445,166
0
0
0
0
Well I see you've checked Unity3D already, but I can't think of any other engines work on PC, Telephones and via streaming internet that suport 3D (for 2D check EXEN or any others). I'm also pretty sure that you can use Unity code-based, and it supports a couple of different languages, but for Unity to work you can't just import unity.dll (for example) into your code, no you have to use your code into unity so that unity can make it work on all these different platforms.
0
1,543
0
0
2011-03-26T20:41:00.000
javascript,python,game-engine
3d game engine suggestions
0
2
3
5,445,300
1
0
0
I have some .png images and I want to be able to quickly: (a) Load a .png from a file. (b) Draw some simple lines on top of the .png. (c) Get the contents (bytes) of the resulting image to return as the result of an http request. It sounds like PIL is a good candidate for doing this with relatively little code. However, I'm trying to understand how efficient it is, especially when I have, say, thousands of lines to draw in step (b). The alternative is using PyOpenGL, but before getting into that I wanted to understand if PIL was already fast enough. I was going to ask if PIL used OpenGL under the covers. But that might be the wrong question, because my understanding is that to get the real speed benefit from PyOpenGL I'd want to submit my line vertexes as NumPy arrays. So presumably even if PIL uses OpenGL, I'm going to lose a lot of that benefit when I make an individual PIL call to draw each of my lines? Anybody have concrete data for speed of PIL when drawing lots of primitives?
true
5,446,816
1.2
1
0
2
"Draw some simple lines on top of the .png" is not a computationally intensive task. This doesn't seems to be a good candidate for the GPU since they are better suited for more complex tasks. You've got to realize that the image is initially loaded on the RAM, making it your job to send this data to the GPU memory and then retrieve it back. This operation consumes a few milliseconds, depending on the size of the image, that could be better used for CPU processing. Your application would only benefit from the GPU if it had high arithmetic intensity.
0
2,486
0
0
2011-03-27T02:23:00.000
python,opengl,python-imaging-library,gpu
How fast is Python Image Library's (PIL) ImageDraw Module, for instance as compared to OpenGL?
0
1
1
5,446,952
1
0
0
I have recently converted a library, I originally wrote in C++ with Boost Python wrapping, to C with SWIG wrapping to support more languages. I switched from C++ to C because the library consists only of a set of functions and I also want the library to be callable from C (without having to compile the whole program with a C++ compiler). However there is one thing that was not easy to port, a very small subset of the functions needs the ability to report errors back. In C++/Boost Python that was very elegantly accomplished with throw and exception translation. What would be the most elegant way (on both the C and wrapped language side) to have a subset of functions report errors?
false
5,448,257
0
1
0
0
Take a look at Chapter 4 in C Interfaces and Implementations by Richard R. Hanson.
0
1,235
0
4
2011-03-27T09:11:00.000
python,c,swig
Most elegant way for SWIG wrapped C library to raise exceptions
0
1
2
5,521,222
1
0
0
I would like to monitor the presence of USB devices and have found modules such as PyUSB that serve this purpose. However, I don't know how to run USB detection services alongside the Tkinter main loop. Is this possible?
false
5,453,256
0
0
0
0
Might I suggest that instead of trying to constantly monitor the presence of a USB device you include a search or refresh button that will check just once.
0
874
0
2
2011-03-27T23:36:00.000
python,tkinter,pyusb
Tkinter and detection of USB devices
0
1
2
5,489,197
1
0
0
I am trying to make several different pages where I need to show different texts and buttons. What I did was I created a panel, and then several sizers on it, and then in the next page, I destroyed the panel and recreated the panel again with different contents/sizers. It worked well in Linux, but when I tried the same source in the windows, the first page was okay, but in the second page and onward, it seems the sizers were not applied. I tried various .Update() and .Refresh(), but nothing seems working. It seems only when I maximize the window the sizers get applied and the layout becomes normal. (Again, after panel.Destory() and a new panel generation, the layouts are messed up again.) How do I make two different "pages" (where I click on a button and it goes to the second page) with different contents and sizers in Windows?
false
5,457,644
0.132549
0
0
2
It seems there are better ways to do this, but panel.Layout() solved the problem for now. :)
0
3,727
0
2
2011-03-28T10:28:00.000
python,user-interface,wxpython
wxPython panel redraw in windows
0
3
3
5,458,130
1
0
0
I am trying to make several different pages where I need to show different texts and buttons. What I did was I created a panel, and then several sizers on it, and then in the next page, I destroyed the panel and recreated the panel again with different contents/sizers. It worked well in Linux, but when I tried the same source in the windows, the first page was okay, but in the second page and onward, it seems the sizers were not applied. I tried various .Update() and .Refresh(), but nothing seems working. It seems only when I maximize the window the sizers get applied and the layout becomes normal. (Again, after panel.Destory() and a new panel generation, the layouts are messed up again.) How do I make two different "pages" (where I click on a button and it goes to the second page) with different contents and sizers in Windows?
true
5,457,644
1.2
0
0
3
Calling Layout on the widget's parent is the best way to do this is you are adding or destroying widgets. Sometimes you also need to call Refresh() to make it redraw too, although that might only be required when you're using Freeze/Thaw.
0
3,727
0
2
2011-03-28T10:28:00.000
python,user-interface,wxpython
wxPython panel redraw in windows
0
3
3
5,460,406
1
0
0
I am trying to make several different pages where I need to show different texts and buttons. What I did was I created a panel, and then several sizers on it, and then in the next page, I destroyed the panel and recreated the panel again with different contents/sizers. It worked well in Linux, but when I tried the same source in the windows, the first page was okay, but in the second page and onward, it seems the sizers were not applied. I tried various .Update() and .Refresh(), but nothing seems working. It seems only when I maximize the window the sizers get applied and the layout becomes normal. (Again, after panel.Destory() and a new panel generation, the layouts are messed up again.) How do I make two different "pages" (where I click on a button and it goes to the second page) with different contents and sizers in Windows?
false
5,457,644
0.066568
0
0
1
I agree with using Layout(), but might I suggest just hiding the unused panel instead of destroying it? Using the Show()/Hide() functions of the sizer, you can add both side-by-side and just hide the unused panel instead of destryong it and recreating it each time?
0
3,727
0
2
2011-03-28T10:28:00.000
python,user-interface,wxpython
wxPython panel redraw in windows
0
3
3
5,461,786
1
0
0
I am trying to change the mouse pointer using python xlib. I successfully did it using warp_pointer. But when i try to play any games like Secret Maryo Chronicles, the mouse pointer moves to the rightmost corner of the screen and not the specified location. Why is it so? Can anyone help me with this?
false
5,487,301
0
0
0
0
I'm not familiar with SMC. It may be that it uses warp_pointer itself. I know a lot of games do to simulate the relative motion support only recently introduced to XInput and I think some of them use it to stash the mouse "out of the way". Have you tried it with games that do different things with the mouse?
0
1,321
0
1
2011-03-30T13:55:00.000
python,mouse,xlib
Python xlib warp_pointer not working properly inside games
0
1
2
5,499,581
1
0
0
I am a great python fan. Recently I got an idea to write RTS engine and/or maybe a simple RTS game based upon this engine. There are a couple of things I need to think about and maybe you can give me some advice on these: Performance. Most games are written in C++. Isn't python too slow for game engine? I am aiming only at 2D, but still it may be too demnading. Graphics. Are there any good graphics libraries for python? SDL/OpenGL bindings or maybe something more suitable for python? Game engines. Do you know of any existing RTS engine written in python? Any tools/libraries for python that maybe helpful in developing RTS Thanks in advance!
true
5,544,634
1.2
1
0
7
Performance may be an issue with heavy graphics/math processing. If so, see Panda3D, NumPy, Cython, and PyPy. Use Pyglet, PyOpenGL with Pyglet, Panda3D (although you are writing in 2D, you can still use a 3D engine), or perhaps some other library. There don't seem to be existing RTS libraries, but there are definitely pre-existing generalized engines. Try searching for RTS-related libraries in general: you'll need AI, pathfinding, networking, and so on. Therefore, you may be interested in Twisted, for instance, since it helps with networking.
0
2,553
0
3
2011-04-04T21:36:00.000
python,performance,graphics,real-time-strategy
2D RTS in Python?
0
2
2
5,544,725
1
0
0
I am a great python fan. Recently I got an idea to write RTS engine and/or maybe a simple RTS game based upon this engine. There are a couple of things I need to think about and maybe you can give me some advice on these: Performance. Most games are written in C++. Isn't python too slow for game engine? I am aiming only at 2D, but still it may be too demnading. Graphics. Are there any good graphics libraries for python? SDL/OpenGL bindings or maybe something more suitable for python? Game engines. Do you know of any existing RTS engine written in python? Any tools/libraries for python that maybe helpful in developing RTS Thanks in advance!
false
5,544,634
0.291313
1
0
3
I can answer your first two. Python isn't too slow for games. That all games must be written in C++ is a myth. Sure C++ (or C) might give you the best performance, but it doesn't mean you're unable to write a game in another language. Try PyGame: SDL bindings for Python.
0
2,553
0
3
2011-04-04T21:36:00.000
python,performance,graphics,real-time-strategy
2D RTS in Python?
0
2
2
5,544,672
1
0
0
I am developing an application which has to be able to print a couple of pages with Python. Now I am searching for a method to create these pages and print them. It should work on Linux and Windows. The pages contain tables, images and text. I developed the GUI with PyGtk, but I think it's convenient to create an image or PDF and print it. I have no idea how to do this. Anyone knows a good way for this? Note: The problem isn't the generation. It is the printing of that file.
false
5,572,489
0.066568
0
0
1
Have you considered generating HTML?
0
2,696
1
2
2011-04-06T20:22:00.000
python,pdf,printing,pygtk
OS independent printing with Python
0
1
3
5,572,506
1
0
0
Can anybody recommend how to switch between scenes in pyglet. I.e. menu > game game > menu menu > help ect The only way that i can think to do it off the top of my head is by using different windows, which i am quite sure would be the complete wrong way to do it. Or by overloading all of the window's event functions. Sorry if i haven't made myself clear but any help would be appreciated
false
5,581,447
0.099668
0
0
2
The cocos2d.org framework is built on pyglet and includes scene management.
0
3,236
0
3
2011-04-07T12:58:00.000
python,pyglet
Switching scenes with pyglet
0
1
4
5,590,220
1
0
0
I have a gtk.Table to which I've attached a number of gtk.Buttons, some of which overlap others. I can't figure out how to bring a specific button to the front, however. How do I do it?
true
5,584,398
1.2
0
0
1
I've struggled with an issue similar to this, and came to the conclusion that it wasn't possible in an officially documented manner... gtk.Table doesn't seem to have been designed to deal with the idea that things might overlap. Widgets seemed to be rendered in an order related to (but not exactly) the order they were added into the table. What I ended up doing was determining which widgets were overlapping, and wrote code to toggle their visibility, depending on which one was appropriate for the current state. That was only possible because of the particular nature of my app, it might not work for you. One avenue which I didn't research to far, but might be viable: intercepting the expose event on the gtk table, and propagating it to the children in a specific order (this got complicated quickly, but might work). My understanding of the gtk.Widget events is incomplete, there may be other events that need intercepting as well.
0
200
0
1
2011-04-07T16:29:00.000
python,pygtk
How do I bring a PyGTK Button to the front?
0
1
2
5,585,600
1
0
0
Does anyone know of any articles or code samples to get me started customising the WxPython rich text control? I am trying to extend the rich text control to allow me to insert controls (buttons, text boxes etc) into the editing area e.g. instead of just inserting images or formatted text I would like to be able to insert a control such as a button (similar to the output provided by the HTML controls but I need to provide an editable interface). Looking through the documentation for wxpython and wxWidgets it seems there is the infrastructure built into the controls to support this but I cannot find any help or examples to get me started.
true
5,637,677
1.2
0
0
1
Download the wxpython demo from their site, it should provide you with an in-depth example of a wxRichTextCtrl. Without providing any information about your specific customizations, there is not much else I can help with.
0
328
0
0
2011-04-12T15:25:00.000
python,wxpython,richtext
Where do I start if I want to customise the WxPython rich text control?
0
1
1
5,696,733
1
0
0
hi i am working on a VR engine "vizard" it has (like any other game engine) its mainloop, i want to integrate it with a multi-touch framework "kivy" which has its own mainloop , is it possible to do so? and if you can help me finding references about this topic thank you in advance :D
false
5,646,943
0
0
0
0
It is technically possible, but you should not do it. Simply open up the source, get the code for the two main loops and stitch it together. The results will probably be broken, though.
0
368
0
2
2011-04-13T09:17:00.000
python,multi-touch,kivy
how to integrate two apps (mainloop) together in python
0
1
2
5,647,086
1
0
0
I am a relative newbie with Python and was trying to install wxPython 2.9 using Python 2.6. I did a build from source and then installed the package both being done in a non-standard (local) path. When I try and import wx (having provided the path to the installation folder in my environment variable), I get the following error message: "ImportError: libwx_gtk2u_xrc-2.9.so.1: cannot open shared object file: No such file or directory". Can someone please tell me if I need to build gtk separately? And if yes, how do I go about doing it?
false
5,660,354
0
0
0
0
Add the directory containing the library given in the error to your ld search paths. See the ldconfig(8) man page for details.
1
380
0
0
2011-04-14T08:14:00.000
python,gtk,wxpython
Error while installing wxPython package in a non-standard path
0
1
1
5,660,469
1
0
0
Which is the most efficient method to display a grid of about 1000 clickable images in wxPython ? Currently i am using a GridSizer filled with StaticBitmap objects. But its quite slow for 500+ images. One more thing is that, i have a listbox of categories on the left. That is to filter the images. Categories will be like "All", "Cat 1", "Cat 2" etc. When i click "All", all the image have to be displayed. How i am doing this currently : A VERTICAL BoxSizer will contain n GridSizer objects, one for each category. I add the StaticBitmap objects to multiple GridSizers depending on the categories it belongs to. Then i display only that GridSizer depending on which category is selected This method is also terribly slow for anything over 300 images. So, how do i achieve the same effect efficiently ? .
false
5,680,487
0
0
0
0
I would think a ListCtrl in ICON style would be the best way to do this. If you look at the wxPython Demos, the UltimateListCtrl sample in the wx.LC_ICON style is a good example of what you could create.
0
796
0
1
2011-04-15T17:50:00.000
python,image,performance,wxpython
Efficient method for a grid of clickable images in wxPython?
0
1
2
5,681,008
1
0
0
I really like D(2) language and would like to use it for multi-platform GUI application, but I see that its ecosystem is not quite developed. After moving from Linux to (Free)PC-BSD, I see there is even no 64bit compiler ready in the ports and one is not sure if any of GUI libs (QtD, gtkD, wxD) are ready for serious project and we would like to start with the project as soon as possible. Otoh, I was previously recommended to try with Python which is mature, with many tools, GUI libs etc. but there was question about speed - we have to use one C lib for calculating Ephemeris and write several libraries which would use that C-lib. However, this might be good (perfect) job for Cython, so my question is what do you think about writing GUI-part in Python (Qt,EFL) and use Cython for performance-critical stuff (binding external C lib and writing our own libraries) instead of (waiting for) D to become ready for serious projects?
false
5,685,078
0.049958
0
0
1
Well, its a typical usecase to just write your number crunching code in C/C++ or any language that can be linked into a C module and just add the non performance critical stuff with a scripting language easily. The Python C interface is okay to work with and using SWIG or even writing the binding code manually isn't too hard (unless you talk about threads and need to handle CPythons idiotic GIL...).
0
1,579
0
4
2011-04-16T07:14:00.000
python,user-interface,d,cython,cpython
multi-platform gui app in C(P)ython or D
0
3
4
5,687,119
1
0
0
I really like D(2) language and would like to use it for multi-platform GUI application, but I see that its ecosystem is not quite developed. After moving from Linux to (Free)PC-BSD, I see there is even no 64bit compiler ready in the ports and one is not sure if any of GUI libs (QtD, gtkD, wxD) are ready for serious project and we would like to start with the project as soon as possible. Otoh, I was previously recommended to try with Python which is mature, with many tools, GUI libs etc. but there was question about speed - we have to use one C lib for calculating Ephemeris and write several libraries which would use that C-lib. However, this might be good (perfect) job for Cython, so my question is what do you think about writing GUI-part in Python (Qt,EFL) and use Cython for performance-critical stuff (binding external C lib and writing our own libraries) instead of (waiting for) D to become ready for serious projects?
false
5,685,078
0.099668
0
0
2
Writing the GUI in a dynamic language and writing performance-sensitive code in another language is a great way to write an application. This can be done in Python, it can also be done really easily in Tcl/Tk and several other scripting languages.
0
1,579
0
4
2011-04-16T07:14:00.000
python,user-interface,d,cython,cpython
multi-platform gui app in C(P)ython or D
0
3
4
5,687,640
1
0
0
I really like D(2) language and would like to use it for multi-platform GUI application, but I see that its ecosystem is not quite developed. After moving from Linux to (Free)PC-BSD, I see there is even no 64bit compiler ready in the ports and one is not sure if any of GUI libs (QtD, gtkD, wxD) are ready for serious project and we would like to start with the project as soon as possible. Otoh, I was previously recommended to try with Python which is mature, with many tools, GUI libs etc. but there was question about speed - we have to use one C lib for calculating Ephemeris and write several libraries which would use that C-lib. However, this might be good (perfect) job for Cython, so my question is what do you think about writing GUI-part in Python (Qt,EFL) and use Cython for performance-critical stuff (binding external C lib and writing our own libraries) instead of (waiting for) D to become ready for serious projects?
true
5,685,078
1.2
0
0
7
I'm obviously biased as a Cython core developer, but I can certainly recommend it. The combination of CPython and Cython provides an otherwise hard to reach level of developing speed, platform stability, portability, low-level coding and FFI capabilities, and execution performance, including a very easy optimisation path from quick and simple to highly tuned code at C speed. I can also warmly recommend Qt as a GUI toolkit. It works very nicely with Python.
0
1,579
0
4
2011-04-16T07:14:00.000
python,user-interface,d,cython,cpython
multi-platform gui app in C(P)ython or D
0
3
4
5,686,614
1
0
0
When chatting in IRC yesterday about the possibility to use P(C)ython instead of D for multi-platform GUI application, someone suggested me Enlightenment Foundation Libraries (EFL). We have researched a bit about it and considering we would like to target some mobile-platform in the future as well, EFL looks as nice alternative to Qt. So, what do you think how does EFL (used via Python bindings) compare with Qt (pyqt or pyside, depending on py3k readiness) for multi-platform desktop GUI application?
true
5,685,176
1.2
0
0
2
EFL looks good and promising, especially its widget toolkit which can do very smart things when resizing windows, but there are problems with it: first, it comes in a very-beta quality. Second, the widgets will look quite unfamiliar for the users. Qt is mature and stable, and it adapts to the platform look and feel (but still may be easily customized). I give PyQt a go.
1
1,308
0
2
2011-04-16T07:38:00.000
python,qt,pyqt,pyside
Qt or EFL for multi-platform Python application
0
1
1
5,688,829
1
0
0
There are a number of Tkinter builders out there but none (that I've found) that work for Python 3. I don't have the time to learn Tkinter and don't use it much which is why I'm looking for a builder.
true
5,691,674
1.2
0
0
0
Wow, pity I didn't get any useful responses. Fortunately I have discovered a solution. PyQt4 may not be Tkinter but it works just the same ... and works in python 3.x and comes with a GUI designer that is very neat. Takes a bit of research to know how to use it but well worth it
0
12,993
0
3
2011-04-17T05:25:00.000
python-3.x,tkinter,builder
Tkinter GUI Builder
0
1
4
5,743,059
1
0
0
Using PyQt4 and Python 3 do you know how I can change the color of a QLcdNumber during the runtime ?
true
5,692,968
1.2
0
0
1
Didn't use this for some thime, but I think you had to change paletteForegroundColor and change segmentStyle to QLCDNumber::Filled or QLCDNumber::Flat
0
1,466
0
0
2011-04-17T10:22:00.000
python,qt,python-3.x,pyqt4
Change the color of the text of QLcdNumber
0
1
1
5,693,049
1
0
0
I have a Python code whose output is a .png file. What should I do to get the output in an OpenGL window? I searched a few places and the closest I got to converting an Image was StringIO() but that didn't seem very helpful.
false
5,699,508
0
0
0
0
If you want something to handle the more complex details you could setup your OpenGL using pygame then use surface = pygame.image.load(fileobj) Where fileobj is any object with a 'file-like' interface. You would need to modify the PNG generator to write to this object rather than a real file.
0
224
0
0
2011-04-18T06:59:00.000
python,image
How to change a .png output from Python to an OpenGL window output?
0
1
2
5,699,658
1
0
0
I basically want to make a clone of the classic game Pacman using Python. I would like to keep all the original graphics, sounds, etc. Perhaps being able to have the game in windowed mode would be useful. With Java I would just use Swing and be done with it. But I'd really like to use Python and make it possible for the game to work on all major platforms with minimal effort from the users. I've used pygame previously but felt that it was a bit 'hacky' and not all that intuitive to use.
false
5,743,946
0.066568
0
0
1
You could do this with Tkinter about as easily (or easier) than most other toolkits. Since pac-man graphics set the bar pretty low you could code this all by using the canvas widget. This is arguably the most portable solution since Tkinter is the official, bundled GUI toolkit so you won't require people to download any extra libraries. The canvas widget gives you a nice vector-based drawing surface, with nice tagging abilities that let you easily move drawn objects. It supports all the basic drawing primitives -- lines, circles, etc. as well as being able to embed bitmap graphics and even other widgets.
0
310
0
1
2011-04-21T12:15:00.000
python,pygame,pacman
What would be a good python library to use to write a portable version of pacman with nice graphics?
0
1
3
5,763,788
1
0
0
I want to use qt with python. "import qt" return me :"ImportError: No module named qt". I already instaled pyqt. what I hve to install in order to activate "import qt" Thank You
false
5,766,539
0.291313
0
0
3
import PyQt4 works for me fine.
1
22,987
0
10
2011-04-23T19:56:00.000
python
problem with import qt in python
0
1
2
5,766,552
1
0
0
I want to expose some kind of graph explorer widget in Python using PyQt and some library. Does such a library exist?
false
5,768,566
0
0
0
0
Try the nodebox-gl fork version of nodebox that support unix, but I can't find the fork version graph in nodebox :( Thanks
0
5,195
0
2
2011-04-24T04:05:00.000
python,graph,pyqt,graphviz
Python graph visualization and editing with PyQt
0
1
4
5,926,728
1
0
0
I'm looking for a Python 2D graphics library that can basically do the following and not necessarily anything more: Create a window of specified width and height Set the RGB of pixel X, Y on the back buffer. Swap buffers ...and that's it basically. I can't find anything that doesn't come with a massive amount of complex baggage.
true
5,770,944
1.2
0
0
4
I recommend PyQt for this - it's a GUI library/framework but it has very good drawing capabilities. If you look at the examples coming with PyQt, focusing on the graphics & drawing samples, it's quite amazing what you can do with very few lines of code. Oh, and it does the double-buffering you mention automatically so you don't have to worry about it. Alternatively, you can use PyGame - a library wrapping SDL, used for game development. Naturally it has very strong 2D graphics capabilities.
0
4,847
0
2
2011-04-24T14:04:00.000
python,graphics,2d
Basic Python 2D graphics?
0
1
1
5,770,967
1
0
0
I'm working on a project that basically follows a pre-defined structure, like a state machine or a wizard. I stumbled upon QWizard, its nextId() function seemed to be a good way to make my wizard dyamically load further pages. Now, it would be very nice to go back to earlier, already visited pages of the wizard. But even with overloaded nextId() I can't go back to that already visited pages. Is is possible to clear the visited pages history? Or is there a better way to do this? I use Qt by PyQt4 in Python, but that should make that much of a difference. Another way to do what I ask would be to add a similar page to the wizard and share the previous data with this page, but coming from mostly C++ I don't like the way to create dummy objects that mimic originals. Edit: What I'm trying to do is to replicate a state machine with QWizard (because it almost is a state machine). For example, on page 1 data is loaded, then on page 2 additional computations happen that potentially extend page 1 data. By using the back button I can go back to page 1, but I can not "go back" with the next button because page 1 is already visited at this point. I tried it by overloading the nextId() functions but it doesn't work. This means I can not build a cyclic order of pages, which I would like to do.
false
5,788,526
0
0
0
0
I'm not sure I see the logical connection between the different questions you're asking here. If you want to go back to already visited pages, why do you want to delete the history? With the help of overloading the nextID method of either the QWizard or separate QWizardPages you can easily implement any custom visiting order you desire. Use the hasVisitedPage method to find out whether some page was already visited. visitedPages returns the list of IDs of visited pages, in the order in which the pages were visited. What else do you need?
0
607
0
2
2011-04-26T09:40:00.000
python,qt,pyqt,qwizard
QWizard: delete history of visited pages
0
1
2
5,788,678
1
0
0
I'm using Qt with Python, and I've got a mainwindow with a status bar at the bottom. I can display a message in the bar using a QLabel, and set the color of that message using something like "<font color=\"green\">In progress</font>" for the QLabel text. I would like to also put a temporary message in the status bar, and assign a color to that message as well. However since it's not a QLabel this time (I'm using QStatusBar::showMessage which just takes a QString) I can't change the color anymore. The tags above are not recognized and the entire string "<font color=\"green\">In progress</font>" is shown in gray. Does anyone have any ideas?
false
5,795,214
0.066568
0
0
2
If your showMessages text will be all of the same color, you can define it in the palette of QStatusBar via QtDesigner(window text color) for temporary messages, and then use the QLabel color for normal and permanent messages of different colors.
0
10,542
0
5
2011-04-26T19:06:00.000
python,qt,qstatusbar
Qt statusbar color
0
1
6
11,617,883
1
0
0
I have a toolbar that has the typical buttons: new, save, save as, etc. Is there a way to gray out/disable/make unavailable icons that are not useful? For instance, if nothing has been changed, disable and gray out the save button, then re-enabled it when something has changed that requires a save. Thanks for the help!
true
5,808,881
1.2
0
0
0
myButton.set_sensitive(True) # make button available myButton.set_sensitive(False) # make button unavailable
0
128
0
1
2011-04-27T18:38:00.000
python,pygtk
Make a pygtk stock icon "unavailable"
0
1
1
5,810,073
1
0
0
Xcode 3 had templates for building Cocoa subclasses in Python. I've recently upgraded to Xcode 4 but I cannot find out how I can use other languages besides the C family (C, C++, Obj-C) in Xcode 4. Does anyone know?
false
5,843,508
0.132549
0
0
2
I've successfully built a MacRuby GUI app in XCode 4.2 on Lion today following a MacRuby tutorial on Apple's site. MacRuby also includes a template in XCode 4.2. I'm a Python programmer and really hoped to use it, but at this point I've given up on PyObjC. I use Tk in Python for quick little apps and maybe switch to MacRuby, but will likely just switch to Objective-c. Ruby is a pretty nice language though. Maybe MacRuby will interest you.
1
7,826
0
13
2011-04-30T17:39:00.000
python,xcode,xcode4,pyobjc
PyObjC on Xcode 4
0
1
3
7,815,044
1
0
0
For my sins (and for fun the learning experience) I am writing a window manager (I know, I know). I'm using python and XCB (python-xpyb). So far I have figured out that I need to use a SubStructureRedirect mask on the root window(s), and I am successfully being passed events related to applications' top-level windows. I'm testing this by launching xterm. I get a ConfigureRequestEvent, followed by a pause, followed by another ConfigureRequestEvent, and then a MapRequestEvent. When I get the MapRequestEvent I call connection.core.MapWindowChecked(e.window), which works, but maps a window that is only a pixel or two wide/tall. My question, then, is what should I do with the ConfigureRequestEvent to make the window the correct size (assuming thats what I'm missing)? More accurately, what exactly do i call? MapWindowChecked was an obvious choice, but I can't seem to find how to actually configure the width/height. I'm guessing it is ConfigureWindow, but the arguments that accepts seem obscure to me. Last time I called it I used xcb.xproto.CW.EventMask, but none of the flags in CW seem to be related to width/height. PS The documentation on all of this seems quite elusive to me. I've looked at a couple of python window managers that supposedly use xcb, and they seem to use their own custom versions with extra functionality. Also, Examining/debugging a running window manager (which is also responsible for mapping your debugger's window) is a PITA, hence my asking here. probably would be better to use two machines or a VM or something. Thanks.
false
5,845,717
0.197375
0
0
1
The short answer is configure the window (size, stacking, etc.) by calling ConfigureWindow. The long answer is here you impose policy and honor specs such as XSizeHints. Best to have a look at some existing WMs' source and get a sense of what they do. Exactly what you do depends on your desired UI. The simplest thing to get it working is to just ConfigureWindow exactly as the request asks with no policy or hint overrides. But you'll probably see lots of usability problems quickly and have to add some more smarts.
0
848
1
2
2011-05-01T01:17:00.000
python,x11,window-managers,xcb
What should a Window Manager do with a ConfigureRequestEvent?
0
1
1
5,851,984
1
0
0
I'm just beginning a very simple pygame code that draws a green line on a white background. However, I have to use pygame.display.flip() in order for it to show up, but it seems that I would have to use this every time I made a change and this seems too impractical for me to be doing it right. Am I missing something?
true
5,851,656
1.2
0
0
3
There's a good reason for this. Double buffering is a technique used to prevent "flickering". Basically, you want to draw a frame to memory instead of to the monitor and then push the frame all at once when its drawn. Otherwise, you can see different elements of the same frame go up at different times. What you want to do is call pygame.display.flip() only once per frame draw, not after every change. Usually, this is done by having a "draw" function that is called at the end of a frame once the physics manipulations and game rules are done, and flip()ing at the end of draw.
0
1,583
0
2
2011-05-01T21:46:00.000
python,pygame
Beginner problem with pygame
0
1
2
5,853,562
1
0
1
I am running Python2.7.1 and OpenCV 2.2 without problems in my WinXP laptop and wrote a tracking program that is working without a glitch. But for some strange reason I cannot get the same program to run in any other computer where I tried to install OpenCV and Python (using the same binaries or appropriate 64 bit binaries). In those computers OpenCV seems to be correctly installed (although I have only tested and CaptureFromCamera() in the webcam of the laptop), but CaptureFromFile() return 'None' and give "error: Array should be CvMat or IplImage" after a QueryFrame, for example. This simple code: import cv / videofile = cv.CaptureFromFile('a.avi') / frame = cv.QueryFrame(videofile) / print type(videofile) / print type(frame) returns: type 'cv.Capture' / type 'NoneType' OpenCV and Python are in the windows PATH... I have moved the OpenCV site-packages content back and forth to the Pyhton27 Lib\Site-packages folder. I tried different avi files (just in case it was some CODEC problem). This AVI uses MJPEG encoding (and GSpot reports that ffdshow Video Decoder is used for reading). Images work fine (I think): the simple convert code: im = cv.LoadImageM("c:\tests\colormap3.tif") cv.SaveImage("c:\tests\colormap3-out.png", im) opens, converts and saves the new image... I have tested with AVI files in different folders, using "c:\", "c:/", "c:\" and "c://". I am lost here... Anyone has any idea of what stupid and noob mistake may be the cause of this? Thanks
false
5,858,446
0
0
0
0
This must be an issue with the default codecs. OpenCV uses brute force methods to open video files or capture from camera. It goes by trial and error through all sources/codecs/apis it can find in some reasonable order. (at least 1.1 did so). That means that on n different systems (or days) you may get n different ways of accessing the same video. The order of multiple webcams for instance, is also non-deterministic and may depend on plugging order or butterflies. Find out what your laptop uses, (re)install that on all the systems and retry. Also, in the c version, you can look at the capture's properties look for cvGetCaptureProperty and cvSetCaptureProperty where you might be able to hint to the format. [EDIT] Just looked i tup in the docs, these functions are also available in Python. Take a look, it should help.
0
1,705
0
1
2011-05-02T14:34:00.000
opencv,python-2.7,iplimage
IplImage 'None' error on CaptureFromFile() - Python 2.7.1 and OpenCV 2.2 WinXP
0
1
3
5,859,924
1
0
0
I'm trying to create a simple game where the point is to collect as many blocks as you can in a certain amount of time, say 10 seconds. How can I get a timer to begin ticking at the start of the program and when it reaches 10 seconds, do something (in this case, exit a loop)?
false
5,890,304
1
0
0
9
Using time.time()/datetime.datetime.now() will break if the system time is changed (the user changes the time, it is corrected by a timesyncing services such as NTP or switching from/to dayligt saving time!). time.monotonic() or time.perf_counter() seems to be the correct way to go, however they are only available from python 3.3. Another possibility is using threading.Timer. Whether or not this is more reliable than time.time() and friends depends on the internal implementation. Also note that creating a new thread is not completely free in terms of system resources, so this might be a bad choice in cases where a lot of timers has to be run in parallel.
1
148,808
0
43
2011-05-04T21:53:00.000
python,time
Timer for Python game
0
1
10
14,132,794
1
0
0
I have a bug in my python script that is using PyQt4 that causes a segmentation fault. I could not find the bug using pdb, so now I wanna try it with gdb. The core file is written and when I open it and type where, I just get memory addresses and only question marks as function names. I already installed the python-qt4-dbg package on Ubuntu but that did not help. Is there any additional parameter I have to pass to gdb to make the function names appear? Cheers, Manuel
false
5,902,379
0
0
0
0
If I remember correctly, you will also need at least libqt4-dbg and python-dbg, maybe a few others..
1
407
0
0
2011-05-05T18:20:00.000
python,gdb,segmentation-fault,pyqt4
Debugging PyQt4 using a core file
0
1
1
5,913,587
1
0
0
Some details of my machine and installed packages before proceeding further: Mac OSX version: 10.6.6 Python version: Activestate Python 2.7.1 wxpython version: wxpython 2.8 (uses Carbon API hence limited to 32-bit mode arch only) I installed wxPython2.8-osx-unicode-py2.7 from wxpython website using their .dmg installer file. This package uses the Carbon API and hence is limited to 32-bit mode only. I have to write my applications using "arch -i386" in order to import wx, and due to this limitation I am unable to import certain other packages likes "MySQLdb" which are not available in 32-bit mode. So, my best option is to uninstall wxpython 2.8 and install wxpython 2.9 because version 2.9 uses Cocoa API which has both 32-bit and 64-bit support. I don't know how to uninstall wxpython2.8 on my Mac OSX. Can anyone please help me?
false
5,920,764
1
0
0
8
If you look in the .dmg for wxPython, there is an uninstall_wxPython.py unininstall script. Just drag it to your desktop and run python ~/Desktop/uninstall_wxPython.py in a terminal.
0
4,762
1
5
2011-05-07T11:33:00.000
python,macos,wxpython,uninstallation
How to uninstall wxpython 2.8 on Mac OSX 10.6
0
1
1
5,922,093
1
0
0
I would like to know where exactly a widget is on the screen.
true
5,930,780
1.2
0
0
4
You want to use the winfo_rootx and winfo_rooty methods of a widget.
0
469
0
2
2011-05-08T22:22:00.000
python,geometry,screen,tkinter
Is there any way to get a widgets position relative to the entire screen in Tkinter?
0
1
1
5,932,003
1
0
0
Is it possible to make a wxPython window only re-sizable to a certain ratio? I know you can disable resizing; however, I'd like it so when the window was resized it stuck to a certain width to height ratio.
false
6,005,960
-0.099668
0
0
-1
I'm not too familiar with wxPython, but can't you just reset the window size to your max/min size that you want once the user pass that? Preferably in the event that detects resizing?
0
7,440
0
5
2011-05-15T01:41:00.000
python,resize,wxpython
Resizing a wxPython Window
0
1
2
6,006,073
1
1
0
I am looking into using sprox but I can't seem to find any information about styling the generated form. I am sure its got to be something obvious but i didn't see it in the docs or find anything using a google/google groups search. Ideally i would use sprox to generate the form but be able to pass in some css for layout. I could just manually create the forms but with the built in validation and select, drop downs pulling in data it seemed worth a look. In a perfect world I would use sprox and pass it to the template and then let my designer have at it for formatting/styling the resulting widget leaving me to not have to fuss with it. TIA!
true
6,006,773
1.2
0
0
0
You should be able to pass the form to the template, render it there while adding any custom css rule inside the template itself. For example using <style> tag inside the template head. If you really want to add a custom CSS on python side you can try to add CSSLink/CSSSource to css key inside form __base_widget_args__ dictionary
0
160
0
1
2011-05-15T02:34:00.000
python,web-applications,sprox
Python / TG2 - Sprox
0
1
1
6,636,134
1
0
0
I need to show a slider in one column of a grid. I was able to create a custom CellEditor which displays the slider when I double click into a cell of the appropriate column so it enters the edit mode. But I don't know how to create a custom CellRenderer that displays the slider in all cell that are not in edit mode. Unfortunately the wx.RendererNative does not offer such a method like DrawSlider() :-( I appreciate any suggestion. Below you can see an example of what is working so far. You can see the one cell with the sl
false
6,020,070
0.197375
0
0
1
Maybe you could use the editor to set the numeric value of the cell, then on the renderer draw a vertical bar by dividing the value by the maximum possible value and multiplying it by the width of the cell (in px, to get the proportion of the cell that the slider needs to appear at) and drawing a narrow vertical rectangle at this point that would act as the indicator, something like: +---------------+ | |-| | +---------------+ Note that this is untested, but I plan to do something similar on my current project. Just out of curiosity, how did you get the slider to appear in the editor?
0
337
0
1
2011-05-16T16:01:00.000
wxpython,wxwidgets
wx/wxPython: How to add a slider to a grid cell?
0
1
1
6,641,179
1
1
0
I am trying to use PyQt to load the html of a web page which can then be manipulated and fed back to the page for web scraping. I am basically trying to log into a page with Javascript on it, search for documents to download (by selecting a check box next to the correct one's names), and then clicking a download button which pops out another page. Does anyone know the functions I would use? Is there a way to discuss this without going into Classes? (My understanding of Classes is not as good as it could be, I am trying to learn, I'm still something of a beginner). Sorry if I didn't explain this well. I'm trying to use either PyQt or PySide to do this.
false
6,032,287
0
0
0
0
I think you are confused about where things happen, so it is not clear to me what it is you are attempting to do, but lets make a guess. I think you want to automate the use of a web site, where you have to call up a selection page, tick a box, click a button and handle the resulting download. If you only want to do it a few times, for testing the site, then check out watir and Selenium. If you really wish to code it up in Python, then you will have to understand the page sent with the check box well enough that you can find and extract the form, create a POST from the fields in that form, and send the POST to get your download. If the page contains javascript this might add/remove/inhibit you from creating a valid post. Then you will have to catch and save the resulting download. And you will have a panic change to your code, every time the site changes its html pages. I don't envy you that job one bit.
0
1,332
0
3
2011-05-17T14:24:00.000
javascript,python,screen-scraping,pyqt,pyside
Outputting and Responding to Javascript with PyQt
0
1
2
6,036,473
1
0
0
I have a wx.ScrolledWindow where is drawn on using cairo. I have implemented a zoom-functionality which right now redraws the whole content. But as there will be up to 200 curves to draw I should consider a more performant solution. I have thought of these: Buffering images for the zoom factors -1/+1 (Memory consuming) Using librsvg and buffer an SVG image (I have read something about this. Does librsvg work under Windows too?) Storing the cairo.Context after drawing groups of curves, and on zoom restoring it (just an idea.. is that possible?) Are there other possibilities, and: what is the best solution? Thanks a lot
false
6,049,208
0.099668
0
0
1
If you're double-buffering anyway, why not do a quick bitmap scale as a "preview" while waiting for the newly redrawn vector image? I confess I don't know how to do this. But if you can make it work, it should work! :)
0
1,049
0
6
2011-05-18T18:15:00.000
python,wxpython,cairo
What is the most performant way to implement zoom to a cairo-drawn canvas?
0
1
2
6,450,169
1
0
0
I was wondering if it is possible (I'm sure it is) to get a reference to a control based on the name of the control. Something like control = findcontrol("btnProduct"+buttonNumber) You probably catch my drift... (and yes, I am a newby in wxPython) Regards, Dennis
false
6,049,481
0.197375
0
0
3
You can use the frame instance's FindWindowByName() method, assuming you passed a unique name parameter to the widget or you might be able to use the frame instance's FindWindowByLabel() method. You can also find by id, but I don't really recommend that since it's better not to manage the ids yourself.
0
1,526
0
4
2011-05-18T18:39:00.000
python,wxpython
wxpython, find control based on its name
0
1
3
6,050,833
1
0
0
I'm currently working the final project for my programming class. We're writing it in Python 3.1, and I'm doing the GUI. My team's leader wants to do the whole project in 3.1, but most pyGame addons (like pyConsole) are giving me compatibility issues. So, my question is, can I write my frontend in 2.5 and then hook it up to the engine that's written in 3.1? Thanks for your help!
false
6,052,379
1
0
0
6
To be honest, that's probably more trouble than it's worth. Your best bet is to get together and make a list of the addons you guys want to use and whether or not they're compatible with 3.1. Then decide if you can live without the incompatible ones. If you can't, do the project in 2.5, otherwise go with 3.1 and have a "Plan B" for the addons you can't use. If you're careful you can make switching from 2 to 3 relatively painless later on when those addons add support for 3.x. If it's a project you plan on working on for a long time (i.e. more than just a class project), I'd probably say go with 3 and try porting some of the addons yourself. But for a class' final project it's probably not worth it.
0
195
0
7
2011-05-18T23:58:00.000
python,python-3.x,pygame
Using Python 3.1 and 2.5 together
0
2
2
6,052,506
1
0
0
I'm currently working the final project for my programming class. We're writing it in Python 3.1, and I'm doing the GUI. My team's leader wants to do the whole project in 3.1, but most pyGame addons (like pyConsole) are giving me compatibility issues. So, my question is, can I write my frontend in 2.5 and then hook it up to the engine that's written in 3.1? Thanks for your help!
false
6,052,379
0.291313
0
0
3
Short Answer NO. Longer Answer. You can write your frontend with Python 2.5 and the backend with 3.0, but they can't interact at all. You need some sort of abstraction layer between them. Doing something like this you can have any language in the other side. The abstraction Layer would need to pull jobs work on them and push back to some sort of queue. This is just a silly example and can get really complicated as you go by. In the end the abstraction layer may become even more complicated than you application, assuming it's a work for a class. I'd listen to Jeremiah and discuss with professor about the goods and bads that you have going with Python 2.5 or 3.0. If you include an explanation of the reasons you choose one over the other in your final papper I'm sure you'll get some extra points and he'll hardly penalyze you for it.
0
195
0
7
2011-05-18T23:58:00.000
python,python-3.x,pygame
Using Python 3.1 and 2.5 together
0
2
2
6,052,534
1
0
0
I need a button that has a bitmap, toggles, and to which I can add a menu (I realize this is asking a lot). I can't figure out a way to do this in wx python. Here are the things I've tried and why they don't work: plate buttons: don't toggle genbitmaptogglebuttons: for some reason, these buttons kill my tooltips (I posted this problem earlier and never got an answer) toolbar buttons: can't add a drop down menu to a button. I would make a separate button for the drop down menu, but the toolbar has to be oriented vertically, and I don't know how to get the drop down button to show up beside its corresponding button, rather than beneath it with vertical a toolbar orientation. bitmap buttons: won't toggle Am I missing something obvious? If not I'm just going to resort to faking a toggle by changing the border/background color, unless someone has a better suggestion. Thanks.
false
6,064,044
0
0
0
0
Per Mark's suggestion, if you have wx 2.8.12 you can use a plate button to get the toggle/bitmap/menu functionality. Since it is not easy for me to update to the newer wx at this point, I'll use a bitmap button and fake the toggle.
0
618
0
0
2011-05-19T19:46:00.000
button,menu,bitmap,wxpython,toggle
wx python bitmap/toggle/menu button
0
2
2
6,073,070
1
0
0
I need a button that has a bitmap, toggles, and to which I can add a menu (I realize this is asking a lot). I can't figure out a way to do this in wx python. Here are the things I've tried and why they don't work: plate buttons: don't toggle genbitmaptogglebuttons: for some reason, these buttons kill my tooltips (I posted this problem earlier and never got an answer) toolbar buttons: can't add a drop down menu to a button. I would make a separate button for the drop down menu, but the toolbar has to be oriented vertically, and I don't know how to get the drop down button to show up beside its corresponding button, rather than beneath it with vertical a toolbar orientation. bitmap buttons: won't toggle Am I missing something obvious? If not I'm just going to resort to faking a toggle by changing the border/background color, unless someone has a better suggestion. Thanks.
false
6,064,044
0
0
0
0
I don't see a pre-built button with all those features. I would think that you can use the generic toggle button or maybe the ShapedButton for your bitmap toggle functionality and attach a right-click popup menu. I'm not really sure what you mean by a menu, so that may not work. If you're talking about a menu implementation similar to the one that the PlateButton has, then you'll probably have to roll your own button. The guys on the wxPython mailing list can tell you how to do that.
0
618
0
0
2011-05-19T19:46:00.000
button,menu,bitmap,wxpython,toggle
wx python bitmap/toggle/menu button
0
2
2
6,064,311
1
0
0
I've got a Canvas which manipulates objects in the mouse event handler. After modifying the objects, I want to trigger the OnPaint() event for the same Canvas to show (rerender) the changes. What is the right way to do this? It doesn't let me call OnPaint() directly. Also, is triggering an event from another event "wrong" in some sense, or likely to lead to trouble?
true
6,076,014
1.2
0
0
4
I would just call self.Refresh() or maybe RefreshRect() and pass the area that needs to be repainted.
0
3,642
0
4
2011-05-20T18:11:00.000
python,drawing,wxpython
Force repaint in wxPython Canvas
0
1
2
6,076,453
1
0
0
I want to provide a listbox where the user can select (multiple) characters (usually close to 15). Quite often some of these will be sequenced, so a listbox is easier than a validated text entry field. Since the character combination has a meaning to the user, it is user friendly to orient the listbox horizontally. Is there an easy way e.g. a theme, setting or subclass of the Tkinter listbox so I do not have to build my own?
false
6,082,723
0.379949
0
0
2
No, there is no setting, subclass or theme that will let you do that with a listbox. What you might want to use instead is a set of check buttons with the indicator turned off so they each appear as a button with a single letter. You can then pack them all horizontally in a frame. With the indicator off, the button will appear sunken when selected, or normal otherwise.
0
1,145
0
0
2011-05-21T15:33:00.000
python,listbox,tkinter
Horizontally oriented listbox using Python and Tkinter
0
1
1
6,083,339
1
0
0
I have a Tkinter program and running it like: python myWindow.py starts it all right, but the window is behind the terminal that I use to start it. Is there a way to make it grab the focus and be the foreground application? Does it depend on the platform?
false
6,091,688
0.132549
0
0
2
This might be a feature of your particular window manager. One thing to try is for your app to call focus_force at startup, after all the widgets have been created.
0
3,844
0
7
2011-05-23T00:10:00.000
python,python-3.x,tkinter,focus
Set focus on Tkinter window (depends on platform?)
0
1
3
6,102,787
1
0
0
I'm learning wxpython right now and one thing that helps me ALOT is when I'm typing in the text editor I sometimes press the tab key to give me a hint on what I'm looking for...This is great when it works but I notice sometimes it doesn't work and I get lost looking for a syntax I can't remember... Question is how can I get the suggestion box to pop back up again, Or what am I doing that causes it to stop coming up... if it matters I backtracked to 2.7 to learn wx, Windows 7 Edit: More specifically... when I type: wx.(Here is normally when I would press tab)
false
6,093,313
0
0
0
0
What editor do you use?? Without knowing that there's no way we can possibly help you. FWIW in vim I use C-x [onp]
0
320
0
0
2011-05-23T05:51:00.000
python
Anyway to bring up suggestion box when typing python code
0
1
1
6,093,396
1
0
0
Have you ever used those cracks and keygens with the really nice interfaces and 8-bit music playing in the bg with special effects when you clicked buttons and stuff? I'd like to create works like such (the GUI part), but I'm wondering which GUI toolkit has that kind of flexibility. Do all GUI toolkits have the ability to create such out-of-the-box (literally) designs? I even remember one famous cracker had a dancing panda or some animal at the top of his program that was really trippy. I bet that wasn't easy. I was planning on trying to get started with Python and PyGTK, if it's even possible, I guess I'll find out.
false
6,111,171
0.379949
0
0
2
I'd wager most of those cracks are written in C or even assembly language, using the Windows API at a very low level. Very few, if any, are written in Python, and positively none are written using GTK. :) Crackers have different aesthetics than ordinary programmers, and they tend to idealize low-level programs with small executable size. They also usually know Assembly, C and low-level Windows API much better than they're familiar with cross platform toolkits such as GTK and Qt. That being said, most modern toolkits can do at least some of what you describe. Playing sound when a button is clicked, for instance, is quite easy: all you have to do is to hook the to the button events and play a sound using your toolkit's sound API (or an additional library if your toolkit doesn't have sound capabilities). The same goes for music. Drawing graphics on your window's background is also possible with most toolkits I know, and although I have no experience with GTK, I guess it can do that as well. Some of the things that might be harder to implement (depending on your toolkit) are non-rectangular windows (e.g. an egg-shaped window), and smooth animations that require at least some sort of double-buffering (if not hardware graphic acceleration support).
0
237
0
0
2011-05-24T13:29:00.000
python,user-interface,interface
Graphical User Interfaces for cracks, keygens, etc
0
1
1
6,112,009
1
0
0
I am trying to create a legend of sorts using ObjectListView in Python. I am able to accomplish this, using wx.PaintDC, DrawText, and DrawRectangle in wxPython, but it doesn't look very good because it is all free hand. Is it possible to create a square image, say a 10x10 pixel square, using wxPython or another package and then insert that image into a column on ObjectListView while changing the fill of that square for each row. For example: CheckBox||State||Population||Legend Color Yes||Massachusetts||6.5million||Red Filled Square Image No||Illinois||12.9million||Blue Filled Square Image Thanks in advance. Chris
false
6,118,139
0
0
0
0
You should be able to add different images to different rows with the ObjectListView widget, if I understand the question correctly. Alternatively, you might want to take a look at the UltimateListCtrl, which was written in pure Python and can have any widget put into it. I think there's a new list control widget in 2.9 too, but I don't remember what new features it added.
0
182
0
0
2011-05-24T23:49:00.000
python,wxpython,objectlistview
Creating a Legend Using ObjectListView
0
1
1
6,142,594
1
0
0
I've never created a GUI before, just simple text based stuff. I think I'm ready to move on to building a GUI and I have a project in mind. Specifically, I'm thinking about creating a simple touch typing tutor game...nothing too fancy. Which python GUI toolkit and builder would lend itself best to a project like this?
false
6,119,508
0.099668
0
0
1
You can use Pygame modul Pygame site has a lot of tutorials, you can use those tutorials as a starting point. Good Luck!
1
867
0
0
2011-05-25T04:21:00.000
python,user-interface
python GUI to build a simple typing tutor game
0
2
2
6,119,548
1
0
0
I've never created a GUI before, just simple text based stuff. I think I'm ready to move on to building a GUI and I have a project in mind. Specifically, I'm thinking about creating a simple touch typing tutor game...nothing too fancy. Which python GUI toolkit and builder would lend itself best to a project like this?
true
6,119,508
1.2
0
0
0
I wrote several application prototypes using the libglade library and the python bindings. I found the toolkit pretty easy to use, it acted just like any other GUI widget framework I've used, but the widgets seemed more ready to grow or shrink to fit the available space easier than many other GUI frameworks. Since they were just prototypes, I can't give you feedback on what it is like to maintain the interface for years -- but they sure went together easily.
1
867
0
0
2011-05-25T04:21:00.000
python,user-interface
python GUI to build a simple typing tutor game
0
2
2
6,119,529
1
0
0
I have a PyGTK GUI that has a gtk.Table. Pressing one button will generate a PNG file. I can show the PNG file in the GUI by adding it somewhere in the table and calling the main window's show_all method again. Is there a better way? What if I want to show more than one PNG file at a time?
true
6,126,044
1.2
0
0
0
You can use a combination of gtk.Image, gtk.HBox (or VBox), and maybe gtk.ScrolledWindow if you plan on showing a lot of images. Just create a new gtk.Image, set the image using set_from_file, then call pack_end on the box to display it.
0
173
0
1
2011-05-25T14:28:00.000
python,gtk,png,pygtk
In PyGTK, what's a good way of displaying an image in a GUI?
0
1
1
6,127,034
1