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 am reading a little bit on Objective-C, and since it comes from Smalltalk, like Ruby does, so I wonder, is it true that if using Ruby, (if Apple change XCode to support it), to develop iPhone or Mac app, it is not suitable really because of the speed? For example, Angry Birds probably isn't as smooth as it is now if using Ruby, vs if Objective-C, it is compiled and running as machine code. But currently, is there any way of compiling Ruby or Python code into machine code so that it is running in the similar speed zone as Objective-C programs can?
false
6,129,086
0.066568
1
0
1
Python and Ruby themselves are not too fast, but many programs today are written to basically do none of the heavy lifting alone. For instance, if you want to save a PNG file as a JPG, you are certainly going to use the built in system calls to do it. In that case it does not really matter if it takes 0.00001 seconds in Obj-C, or 0.001 seconds in Python to process the mouse click, when the optimized system code to convert the image is the exact same code in both programs, and takes, say 1/2 a second to run. On the other hand if you are making a low level data munger of your own design, then you might want some C. Basically all languages that you would use on a Mac allow you to write something in C, and call it from that language, so even that does not slow you down. Pick the language for the task based usually on what everyone else is doing for that problem, intersected with your abilities.
1
1,121
0
1
2011-05-25T18:28:00.000
python,objective-c,ruby,ios
Is Ruby or Python not suitable for iPhone or Mac app development because of speed, and any compiler that can help boost the speed?
0
1
3
6,129,509
1
0
0
My Python backend (Django) has to request to a C++ library to get a result (with help of ctypes module). Is it normal to call a C++ method directly? Or may be I need an intermediate thread manager that starts a new thread when python script wants a result?
true
6,129,383
1.2
1
0
2
Basically you have to decide what kind of operation flow you want. If you prefer synchronous processing you can call you method directly, if you favor asynchronous processing you will need an intermediate solution. However, you have to be aware, that when you call the C++ routine directly form your Django app the call will end in the execution path that is triggered via the web application. If the processing takes more time than you want to wait, a job management system will be the better choice. In any case I would recommend such a solution if the execution of your C++ routine takes too much time. You could then use polling to wait until the result is ready using e.g. Web Sockets.
0
339
0
2
2011-05-25T18:54:00.000
c++,python,django,ctypes,backend
High Perfomance: Do call C++ methods directly from a python backend?
0
1
1
6,129,485
1
0
0
Python script calls an external C++ function (using ctypes). Memory leaks are possible when execution the C++ function. Will all allocated memory (in C++ function) be automatically cleaned up after finishing of the Python script?
true
6,129,933
1.2
0
0
2
Yes, It will all be returned to the OS once the python interpreter exits. This is true for all processes - nothing specific to python or c++.
1
169
0
1
2011-05-25T19:39:00.000
c++,python,ctypes
Call an External C++ function and Memory Leaks: is all allocated memory cleaned up after finishing Python script?
0
1
1
6,129,979
1
0
0
I've gone from one book to another, one google search to another and I notice EVERY SINGLE ONE starts the main window in a completely different way. I don't want to pick up bad habits so can someone please give me the best of these options and why its the better method. Below are all the ways i've seen it done A) class iFrame(wx.Frame): def init(....): wx.Frame._init_(...) B) class iFrame(wx.Frame): def init(...): super_init_(...) C) Then I see some that uses the Panel instead such as class iPanel(wx.Panel) def init(...): wx.Panel.init(...) D) And even more confusing some are using the regular App class of wx class iApp(wx.App): def OnInit(self): wx.Frame.init(...) Forgive me if some of my structures are wrong but I'm recalling these off the top of my head, Question again...Which one of these, IF ANY is the best way to structure the GUI. It's hard following tutorials and books when they all do things in diff ways edit: Sorry if format is not correct, but normally it works...
false
6,133,348
0.148885
0
0
3
Don't worry about it. You aren't going to ruin your future programming by making the wrong choice now. None of the options you mention are wrong. They all do things differently because different applications have different requirements. No one way is best. Just work on what you want and do what works for you, and once you have greater familiarity then you'll understand why different code does it differently.
0
1,956
0
3
2011-05-26T03:23:00.000
python,wxpython
Confused on how to structure the GUI (wxpython)
0
1
4
6,133,380
1
0
0
I need to send a binary file (or a Bitmap object) from Android to a PC, which runs a Python script to receive it. Has anybody been in the same situation or has any hints, what could be best practice here? Options are sockets or Webservice (besides from workarounds with samba etc) I guess, but what is the easiest and fastest to implement? Cheers, Marc
true
6,151,335
1.2
1
0
1
Just doing a HTTP POST containing data to a web server should do the job. This way you have a myriad of frameworks to choose from, which saves you from doing the dirty work of pushing bits back and forth. Sure, there is some overhead, but unless you have specific reasons to avoid that (which were not mentioned in the question), I think this is the most straightforward approach. Additionally, when the application grows, you can extend this to a full REST style interface later on.
0
490
0
2
2011-05-27T11:03:00.000
java,android,python,networking,binaryfiles
How to best send binary file from Android to Python script on PC?
0
1
2
6,151,433
1
0
0
Okay, I'm just starting to get into creating GUIs with python and I'm a bit confused as how how I should go forward: Should I download PyGTK or the current version of GTK+ if I'm using Python or does it matter? Concerning GUI builders, from what people are saying, it seems like GTKbuilder is better to use than Glade because it's built into GTK+? Is GTKbuilder also included in PyGTK or would I have to use Glade with PyGTK?
true
6,158,439
1.2
0
0
1
PyGTK bridges GTK+ to Python, so you need all three. Glade is an application to edit XML files. You'll definitely want it. To read those files you can use either libglade (separate, deprecated) or GtkBuilder (built into GTK+, and therefore PyGTK).
0
255
0
0
2011-05-27T22:58:00.000
python,user-interface,pygtk,glade,gtkbuilder
simple questions about PyGTK, GTKbuilder, GTK+
0
1
1
6,201,626
1
0
0
I noticed the width argument for the Tkinter Text widget is in characters. Is it possible to set a maximum width in characters for the text widget?
false
6,174,390
0.197375
0
0
3
What you want to do isn't directly supported by the widget. You can almost get there by using a couple of tricks. For example, you can set the wrap attribute to wrap at word or character boundaries, then make sure the widget is never wider than 80 characters (this requires using pack/grid/place options appropriately). This technique will work fine for fixed-width fonts, but for variable width fonts it won't always wrap at 80 characters. That is because when you set the width to 80 characters it's actually setting it to a specific pixel width based on 80 times the width of an average character (specifically, the 0 (zero) character, last time I checked). Of course, you can always force it to wrap at 80 characters by monitoring text insertions and deletions and handling the wrapping yourself, but that's usually more work than is worth the effort.
0
8,149
0
3
2011-05-30T09:18:00.000
python,text,fonts,width,tkinter
How to set maximum width in characters for the Text widget?
0
1
3
6,182,702
1
0
0
Is it possible to get the x y coordinates of the insertion cursor in a Tkinter Text widget? I'm trying to make a popup menu that pops up next to the insertion cursor.
true
6,180,944
1.2
0
0
3
The bbox method can be used to get the bounding box of an index. You can use that to get the position relative to the window. You can use the winfo method to get the x/y of the window. Typically popups appear next to the mouse rather than the insertion point (though typically, right-clicking first sets the insertion point and then displays a menu).
0
556
0
2
2011-05-30T21:35:00.000
python,text,popup,tkinter
The Tkinter Text Widget Insertion Cursor
0
1
1
6,181,133
1
0
0
I was thinking about adding pythonqt to my application for writing plugins. My application is in C++ and already uses the Qt framework. The pythonqt option seems like a natural fit for adding GUI components, but I'm concerned about how well the program will scale if I expose an class with millions of instances. It will not be uncommon to have something like a million of a certain type of object in memory and I wanted to make sure pythonqt would be able to expose these objects without making them QObjects. It may be fine, I guess, but before I started, I was wondering if exposing such a large number of classes would be practical using pythonqt and if anyone had any experience with scaling it this much. From this link (http://pythonqt.sourceforge.net/Developer.html), it seems the decorators actually only load them into python/Qt on request. I just don't want an even bigger memory footprint of Qt trying to keep track of these millions of objects for no reason.
false
6,180,947
0.197375
0
0
2
PythonQt only creates Python wrappers for C++ instances that are exposed to Python. So if you do not expose millions of C++ instances to Python at the same time, it will scale nicely and create wrappers only for the exposed objects. These wrappers are deleted when they go out of scope in Python, so this should scale as well. The best way to wrap a C++ object is to register a decorator QObject derived class for each C++ class, this allows to register many classes without actually creating/evaluating the decorators until a class of that type becomes visible to Python. Have a look at the Qt wrappers, e.g. PythonQtWrapper_QImage, to see how such a decorator looks like and how it is registered.
0
310
0
1
2011-05-30T21:35:00.000
c++,python,qt
scalability of pythonqt for millions of objects
0
2
2
10,348,201
1
0
0
I was thinking about adding pythonqt to my application for writing plugins. My application is in C++ and already uses the Qt framework. The pythonqt option seems like a natural fit for adding GUI components, but I'm concerned about how well the program will scale if I expose an class with millions of instances. It will not be uncommon to have something like a million of a certain type of object in memory and I wanted to make sure pythonqt would be able to expose these objects without making them QObjects. It may be fine, I guess, but before I started, I was wondering if exposing such a large number of classes would be practical using pythonqt and if anyone had any experience with scaling it this much. From this link (http://pythonqt.sourceforge.net/Developer.html), it seems the decorators actually only load them into python/Qt on request. I just don't want an even bigger memory footprint of Qt trying to keep track of these millions of objects for no reason.
true
6,180,947
1.2
0
0
0
I haven't done much with it but it almost sounds like you should at least look at QtQuick/QML layer. It is hard to tell from your description what is going on but QML is a way to write Qt GUIs without doing any C++ coding. It build on the already exisiting and well working Qt/JavaScript Implementation and Bridge. As for exposing instances of classes to a scripting language, that would usually depend on the implementation of the bridge. While there is usually some code involved you might not incur that per instance, or it might be lazily instantiated to a point where you will only have much less than the millions of wrapped instances than the originals that you are holding in memory.
0
310
0
1
2011-05-30T21:35:00.000
c++,python,qt
scalability of pythonqt for millions of objects
0
2
2
6,182,460
1
0
0
I'm using PyQt to develop an application that in Windows, if set in preferences, should be able to start at boot. I'm releasing this software with PyInstaller as a single executable file; i don't have a proper "installer". Which is the best way to achieve this? ( = starting at boot) A possible solution is to add a link in the startup folder, but i have to do it from the software: it's possible? Other ways? There is an universal path to the Startup folder? Can i have some rights' problem?
false
6,186,091
0.379949
0
0
4
You may add registry key under [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run], with any name and value "path_to_your_exec". this will require local administrator right, but will work for all users. The same key but starting with [HKEY_CURRENT_USER] will not require administrator privileges, but will work only for current user. That registry path is the same for win2k..win7
1
2,695
0
5
2011-05-31T10:17:00.000
python,windows,pyqt,startup,pyinstaller
PyQt: best way to do the trick "start at boot" for my program in Windows
0
1
2
6,186,198
1
0
0
I have 4 spinctrls in my app. When I click on them, I want all their content to be selected instantly. And another thing is, I need to make them tab traversal. Can you help me with some sort of code to do this task? Thanks in advance.
false
6,189,047
0.379949
0
0
2
You need to catch EVT_SPIN or EVT_SPINCTRL and in your handler, you can select all the values by calling each of the control's GetValue method. In the wxPython demo, it seems to support tab traversal. I'm not sure what's going on with yours. Did you try the FloatSpin widget as an alternative?
0
158
0
0
2011-05-31T14:24:00.000
python,wxpython
Make Spinctrl selected when activated in WxPython
0
1
1
6,191,925
1
1
0
The engine I've been wanting to remake is from a PlayStation 1 game called Final Fantasy Tactics, and the game is basically a 2.5D game I guess you could say. Low-resolution sprites and textures, and 3D maps for battlefields. The plan is to mainly load the graphics from a disc, or .iso (I already know the sectors the graphics need to be read from) and fill in the rest with game logic and graphics routines, and probably load other things from the disc like the map data. I want this to be a multiplatform project, because I use Linux and would like for more people to join in on the project once I have enough done (and it's easy to get more people through platforms like Windows). I'll be making a website to host the project. Also, none of the graphics will be distributed, they'll have to be loaded from your own disc. I'd rather not have to deal with any legal issues.. At least not soon after the project is hosted on my site. But anyway, here's my dilemma- I know quite a bit of Java, and some Python, but I'm worried about performance/feature issues if I make this engine using one of these two languages. I chose them due to familiarity and platform independence, but I haven't gotten too into graphics programming yet. I'm very much willing to learn, however, and I've done quite a bit of ASM work on the game- looking at graphics routines and whatnot. What would be the best route to take for a project like this? Oh, and keep in mind I'll eventually want to add higher-resolution textures in an .iso restructuring patch or something. I'm assuming based on my results on Google that I could go with something like Pygame + OpenGL, JOGL, Pyglet, etc. Any suggestions on an API? Which has plenty of documentation/support for game or graphics programming? Do they have any serious performance hits? Thank you for your time.
true
6,195,508
1.2
1
0
0
I'd recommend going with PySFML, and, of course, Python. If you do your Python programming correctly , and if you really are willing to fiddle with C or ASM Python plugins for faster computations, you shouldn't really have too much performace hits.
0
213
0
1
2011-06-01T02:04:00.000
java,python
Game Engine Remake - Trouble Choosing a Language /API(Java or Python)
0
2
3
6,195,610
1
1
0
The engine I've been wanting to remake is from a PlayStation 1 game called Final Fantasy Tactics, and the game is basically a 2.5D game I guess you could say. Low-resolution sprites and textures, and 3D maps for battlefields. The plan is to mainly load the graphics from a disc, or .iso (I already know the sectors the graphics need to be read from) and fill in the rest with game logic and graphics routines, and probably load other things from the disc like the map data. I want this to be a multiplatform project, because I use Linux and would like for more people to join in on the project once I have enough done (and it's easy to get more people through platforms like Windows). I'll be making a website to host the project. Also, none of the graphics will be distributed, they'll have to be loaded from your own disc. I'd rather not have to deal with any legal issues.. At least not soon after the project is hosted on my site. But anyway, here's my dilemma- I know quite a bit of Java, and some Python, but I'm worried about performance/feature issues if I make this engine using one of these two languages. I chose them due to familiarity and platform independence, but I haven't gotten too into graphics programming yet. I'm very much willing to learn, however, and I've done quite a bit of ASM work on the game- looking at graphics routines and whatnot. What would be the best route to take for a project like this? Oh, and keep in mind I'll eventually want to add higher-resolution textures in an .iso restructuring patch or something. I'm assuming based on my results on Google that I could go with something like Pygame + OpenGL, JOGL, Pyglet, etc. Any suggestions on an API? Which has plenty of documentation/support for game or graphics programming? Do they have any serious performance hits? Thank you for your time.
false
6,195,508
0
1
0
0
At the end of the day if you're passionate about the project and committed to getting the most out of the language you choose, the performance difference between java and python will be minimal if non-existent. Personally speaking, the biggest challenge is finishing the project once it loses novelty and initial momentum. I suggest you go with whichever language you're more passionate about and are interested in plumbing the depths of, or one that could boost your resume. Secondly, as you mention you're hoping to attract contributors, you may want to factor that into your decision. I can't comment much here, but have a look at similar projects with lots of activity. Good luck!
0
213
0
1
2011-06-01T02:04:00.000
java,python
Game Engine Remake - Trouble Choosing a Language /API(Java or Python)
0
2
3
6,195,870
1
0
0
I would like to execute a method which can only be called once my QApplication is displayed, i.e. when it has entered its main event loop exec_(). I'm new to Qt4 (using PyQt4): i was hoping to have a on_start()-like callback, but didn't find one. Do i need to create a thread or a timer? Or is there some callback included in the API already?
false
6,215,690
0
0
0
0
I haven't used Qt before, so I might be wrong on this, but I imagine you could bind your on_start() method to the ApplicationActivate event, and set a flag from inside your on_start() method so that the code would only be run that very first time and not any other times the ApplicationActivate event is triggered during execution of your program. On the other hand if the on_start() method would be called by multiple threads, you might want to use thread-specific flags. Haven't done much multithreading myself, so I'm not sure of what the specifics for that would be, or how simple/complicated it would be.
0
4,716
0
4
2011-06-02T14:11:00.000
python,multithreading,timer,pyqt4,event-loop
How to execute a method automatically after entering Qt event loop?
0
1
3
6,218,924
1
1
0
I want to develop an application targeting both android and iphone. I guess they use Java and Objective-C. Can I use single language like Python? Is it the best route? Will I lose performance, features, etc. by using Python. Are there any limitations that I will run into?
false
6,216,890
0
1
0
0
phonegap is one of the way that you can use to target the iphone & android.through the javascript,html.
0
1,256
0
3
2011-06-02T15:47:00.000
python,android,iphone,beeware
target both android and iphone with Python
0
1
4
6,217,111
1
0
0
I am binding C++ classes to Python and have come to an interesting solution to a previous problem, unfortunately this has lead to another question that there seems to be no easy answer too. I am wrapping each function into a "callable" PyObject, what makes it callable is having the call function define (C side this is the tp_call method in the PyTypeObject). The tp_call seems to take a ternary function which just accepts (PyObject*, PyObject*, PyObject*) as its argument list. Now the problem is that I need for this function to just take the place of the PyCFunction, which just takes the arguments (PyObject* self, PyObject* args). Now python side this can be done easily, but C side it seems to need the ternary function when I just want a binary one, so is there anyway to make the callable function simple take the PyCFunction pointer or a way to encapsulate it as such?
true
6,221,533
1.2
0
0
3
The third PyObject* is the kwargs. Write a wrapper that just... doesn't pass them. Raising TypeError if it contains anything is optional.
1
390
0
0
2011-06-02T23:32:00.000
python,callable
What is the exact requirement for defining a python tp_call function?
0
1
1
6,221,593
1
0
0
My python code is calling a C function in a native library (also written by me). The function takes two strings as arguments and returns its response as a string. The two argument strings that python passes to C library are only read by the C library, so I am not worried about their memory management. AFAIK, their memory will be allocated by python and will be released when the python runtime seems it appropriate. However, I understand that the memory of the string that C library returns has to be managed explicitly. One way I can implement it is: the C function callocs a character array, populates it with answer and returns from the function. The python code uses the returned string and should call libc's free on that string or call another function of the same C library which will take care of freeing the memory. Is there any other way to do this? Does ctype offer any utility functions that simplify releasing the memory of data structures returned by native libraries?
false
6,229,610
0.291313
0
0
3
A common way to do this is adding an additional buffer parameter and a length parameter to the C function. If the function is called with a buffer size that is smaller than the required size, the function simply returns the required buffer size and performs no other action, otherwise, the data is copied into the buffer and the size is set to the actual size of the data copied. This allows you to manage the buffer in Python, at the expense of adding 2 additional parameters to your C function.
1
2,432
0
1
2011-06-03T16:00:00.000
python,memory-management,ctypes
How to manage string memory with python ctypes
0
1
2
6,229,664
1
0
0
I am writing one of the Mobile monitoring program in my phone which I almost finished it. My program has a pedometer which counts human's steps in a real time manner. My question is that I am now writing GUI for phone which will show let's say some picture after they accomplish 1000 steps(like an award) and so on. I am just new to python and does not really know anything about GUI in python. My phone is Nokia N79. My question is that where can I get the information about GUI in python in N79 phones something like examples and so on.
true
6,230,525
1.2
0
0
0
Which phone model and OS are we talking about? Is it running Android? I believe pre-Android Nokia phones used Qt GUI framework Python has Qt wrappers, look into PyQt4 for all your UI needs.
0
285
0
0
2011-06-03T17:28:00.000
python,mobile-phones
Python: Making a GUI in nokia phone
0
1
1
6,231,462
1
0
0
I've spent a very frustrating evening trying to get wxpython to work on my MacBook Pro (running Snow Leopard 10.6.6). From reading the various threads on this topic both here and on other websites this is my understanding so far: If you are running python 2.6 or greater you can only work with wxpython if you access the 32-bit version Typing python at the command line prompt reveals that I am using python 2.6.1. Typing which python returns /usr/bin/python so I'm using the default version installed with my OS. This means that typing the following at the command line prompt defaults write com.apple.versioner.python Prefer-32-Bit -bool yes should change the version I'm using to the 32 bit version. With the above in place, I can now simply type the name of my python file (with the wx module imported) and my file will run successfully. As you can no doubt guess however my file doesn't run successfully. I can't figure out what's going on, but maybe someone else can here are some other observations that might help... typing help(), modules yields the following message and then prints out the modules, including wx and wxpython /System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/pkgutil.py:110: DeprecationWarning: The wxPython compatibility package is no longer automatically generated or actively maintained. Please switch to the wx package as soon as possible. __import__(name) /System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/pkgutil.py:110: DeprecationWarning: twisted.flow is unmaintained. __import__(name) /System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/twisted/python/filepath.py:12: DeprecationWarning: the sha module is deprecated; use the hashlib module instead import sha /System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/twisted/words/im/__init__.py:8: UserWarning: twisted.im will be undergoing a rewrite at some point in the future. warnings.warn("twisted.im will be undergoing a rewrite at some point in the future.") Fri Jun 3 22:23:48 Paul-Pattersons-MacBook-Pro.local python[3208] <Error>: kCGErrorFailure: Set a breakpoint @ CGErrorBreakpoint() to catch errors as they are logged. _RegisterApplication(), FAILED TO establish the default connection to the WindowServer, _CGSDefaultConnection() is NULL. Then examining the wx module specifially yields... NAME wx FILE /usr/local/lib/wxPython-unicode-2.8.12.0/lib/python2.6/site-packages/wx-2.8-mac-unicode/wx/__init__.py Can anyone help?
true
6,232,629
1.2
0
0
11
I don't have a Mac, but I read almost all the messages on the wxPython mailing list. As I understand it, you don't want to use the Python that came with your Mac. It has been modified for the Mac specifically somehow, so you should download a normal version of Python and install it. As for the 32-bit question, with wxPython 2.8, you are correct. You are limited to 32-bit because of the Carbon API. However, if you scroll down the download page (http://wxpython.org/download.php) you will see that wxPython 2.9 has been released and it has a Cocoa build which (and I quote) "requires at least OSX 10.5, and supports either 32-bit or 64-bit architectures" and Python 2.7. I highly recommend that you go and seek help on the wxPython mailing list. The author of wxPython is there and he uses a Mac and there are several other Mac addicts on the list too that answer these sorts of questions.
0
662
1
5
2011-06-03T20:58:00.000
macos,wxpython,32bit-64bit
Battling with wxpython
0
1
1
6,232,781
1
0
0
I'm looking at switching programming languages due to some unavoidable roadblocks. However, before I dedicate myself to a whole new language, I need to know if it is possible for me to play .swf or .flv files underneath other GUI elements if I am using OcempGUI and pygame? Will using those two libraries back me into a corner, to where I cannot use other python GUI libraries without a lot of time-consuming patching? Thank you!
true
6,233,805
1.2
0
0
0
Judging from the GUI's features list and usage, it does not appear to support .swf playback. If anyone has evidence to the contrary, an additional answer would be appreciated.
0
461
0
1
2011-06-04T00:12:00.000
python,flash,pygame
Play .swf with Python/Pygame/OcempGUI
0
1
1
8,205,898
1
0
0
I have a small python script which draws some turtle graphics. When my script has finished running, the turtle screen automatically closes, so to be able to see the graphics for a while I have to use time.sleep(5) at the end of the script to delay the closing. Is there any way I can make this more dynamic, i.e. tell python that I want to control the closing of the window myself? I don't mind if the script can't do anything else while waiting for my command, but I'd prefer if I didn't have to go to the console for a read() or something. Ideally, the canvas should stay open even after the script finishes running, but I am OK with a solution that halts the script until I close the window that holds the canvas (or click the canvas, or whatever...). How do I accomplish this?
false
6,234,798
0.119427
0
0
3
Try adding input() at the end of your code.
0
113,747
0
41
2011-06-04T04:59:00.000
python,turtle-graphics,window-management
Turtle graphics - How do I control when the window closes?
0
1
5
8,966,931
1
0
0
When using wxPython, is it possible to remove or disable the "Preferences" menu item that gets automatically created in the Python menu on OS X?
true
6,265,356
1.2
0
0
1
For the benefit of others that may run into this, I figured out the solution: "wx.App_SetMacPreferencesMenuItemId(wx.ID_NONE)". The trick is to do this before you create the menu, not after. On wxPython 2.9.1.1 it will ghost out the Preferences menu item (which is good enough for me). On 2.9.2 it will remove the item completely.
0
145
0
1
2011-06-07T12:45:00.000
macos,wxpython
Remove Preferences menu item on OS X apps
0
1
1
6,540,867
1
1
0
I want to simulate touch event, keyboard event on mobile device. Can I do it with MonkeyRunner? Also, I have the impression that it only works with SDK? I want the application to be installed on mobile, which will perform some random touch, keyboard events. Is it possible with MonkeyRunner? If yes, please provide me help on how to start writing python for mobile, and how to make project for android in Python. I have used Eclipse for java for android, but not for python.
false
6,275,277
0.066568
0
0
1
I want to simulate touch event, keyboard event on mobile device. Can I do it with MonkeyRunner? From your development machine, yes. Per your question title, you cannot use MonkeyRunner on a device. Also, I have the impression that it only works with SDK? Yes. I want the application to be installed on mobile, which will perform some random touch, keyboard events. Is it possible with MonkeyRunner? Fortunately, no, as this would be a massive security hole.
0
1,492
0
0
2011-06-08T07:02:00.000
android,python,monkeyrunner
Can I use MonkeyRunner tool to work in mobile as application
0
1
3
6,278,753
1
0
0
I want to listen on a on a UDP socket for data that will be streamed in and draw it on screen as it comes in. I believe that the socket module with bind will be suitable for receiving the data on the socket, but I am not sure on the best manner to proceed in drawing the data. The image dimensions would be known beforehand and the raw data would be directly drawn starting from any corner and proceeding to fill the image box. I would assume the tkinter library or PyQt would be suitable for this but I don't know if there is a better choice or what I should be aware of when going down either of these paths.
false
6,285,553
0.197375
0
0
2
kinter is included in Python, you need to install PyQt (or PySide) separately. Qt is more modern, so I would probably try it first if deployment isn't problem.
0
275
0
0
2011-06-08T21:33:00.000
python,udp,pyqt,tkinter
How would you draw UDP data as it comes in?
0
2
2
6,285,587
1
0
0
I want to listen on a on a UDP socket for data that will be streamed in and draw it on screen as it comes in. I believe that the socket module with bind will be suitable for receiving the data on the socket, but I am not sure on the best manner to proceed in drawing the data. The image dimensions would be known beforehand and the raw data would be directly drawn starting from any corner and proceeding to fill the image box. I would assume the tkinter library or PyQt would be suitable for this but I don't know if there is a better choice or what I should be aware of when going down either of these paths.
true
6,285,553
1.2
0
0
2
Tkinter has a canvas widget which can be used for drawing. It is vector-based, with primitives for drawing lines, circles, etc. It is very easy to use, and surprisingly powerful. If your drawing is more like a painting where you are receiving instructions for individual pixels, you can create an image, and with that you can change the colors of individual pixels.
0
275
0
0
2011-06-08T21:33:00.000
python,udp,pyqt,tkinter
How would you draw UDP data as it comes in?
0
2
2
6,291,949
1
0
0
Is it possible to integrate Cython and TG2? I have one computation (written in python) which is heavily numerical and would largly benefit from rewriting into C or cython.
true
6,292,320
1.2
0
0
2
Without you having additionally specificity in your question and not knowing what exactly you mean by 'integrate', all I can offer is that cython provides a fairly simple way of (often dramatically) speeding up certain code written in python either via static typing or calling external c/c++ libraries. If there is only a single numerical calculation that can be written in cython and then called from within TG2, then this is a good candidate for using cython. Your mileage will vary though depending on how much of it can be written in something that translates to pure C, versus something that relies heavily on the Python C-API. Some (many actually) numerical calculations are also amenable to the type computations that numpy excels at, so if you haven't tried it, that may be another option. In general though if you want a detailed answer, you should put an equivalent amount of detail in the question.
1
74
0
0
2011-06-09T11:51:00.000
python,cython,turbogears,turbogears2
Mixing cython and turbogears 2.1
0
1
1
6,292,855
1
0
0
I have multiple Tkinter.labels in a row and i would like the user to be able to click and drag their mouse over each one, activating them in the process. I know about bindings, but i need multiple events in a single binding. Ive been messing around with <Button-1> and <Enter>, however i need a callback to be called only when both are true. I know l.bind('<Button-1>,<Enter>', ...) is not valid. Anyone with more Tkinter experience know of a way to chain binding, or make a multi-bind??
true
6,295,440
1.2
0
0
2
The way you solve this particular problem is to have a binding on ButtonPress and ButtonRelease that sets a flag. Then, in your binding for <Enter> (or any other event) you check for that flag. However, while the button is pressed you won't get any <Enter> events. This is because the widget you clicked over grabs the pointer and owns it until you release the button. The only <Enter> events you'll get while the button is pressed are when you enter the widget you originally clicked on. What you want to do instead is bind to <B1-Motion>. You can then use the x/y coordinates of the event and winfo_containing to determine what widget you are over. That being said, trying to simulate selection over a row of labels is a lot of work for very little benefit. Why not just use a text widget that already has selection built in? You can tweak it so that it looks like a bunch of labels (ie: make the background the same color as a frame) and you can turn editing off. That might be an easier way to go.
0
2,142
0
2
2011-06-09T15:32:00.000
python,tkinter
Activate other widgets while mouse dragging
0
1
2
6,296,428
1
0
0
I am running Ubuntu 10.10, and I installed Python 3.2 today. The system is already running Python 2.6. I typed idle3.2 in the terminal and it gave me: IDLE can't import Tkinter. Your Python may not be configured for Tk. So I searched on Stack Overflow (and in some other places) for a solution, I installed python-tk, I rechecked that I have tclsh on the system, but I still can't manage to open idle3.2. Any input would be appreciated.
false
6,320,954
0.024995
0
0
1
If you installed python-tk and the system is running python 2.6 then it is most likely that you installed Tkinter for python 2.6. Try installing python3-tk.
0
46,374
0
8
2011-06-12T08:27:00.000
python,linux,ubuntu,python-3.x,tkinter
IDLE can't import Tkinter. Your Python may not be configured for Tk
0
4
8
6,338,479
1
0
0
I am running Ubuntu 10.10, and I installed Python 3.2 today. The system is already running Python 2.6. I typed idle3.2 in the terminal and it gave me: IDLE can't import Tkinter. Your Python may not be configured for Tk. So I searched on Stack Overflow (and in some other places) for a solution, I installed python-tk, I rechecked that I have tclsh on the system, but I still can't manage to open idle3.2. Any input would be appreciated.
false
6,320,954
0.049958
0
0
2
The problem is caused by the version between python and idle not matching. U can check your python version by typing : python Then sudo aptget install the right idle version same with your python version
0
46,374
0
8
2011-06-12T08:27:00.000
python,linux,ubuntu,python-3.x,tkinter
IDLE can't import Tkinter. Your Python may not be configured for Tk
0
4
8
13,890,255
1
0
0
I am running Ubuntu 10.10, and I installed Python 3.2 today. The system is already running Python 2.6. I typed idle3.2 in the terminal and it gave me: IDLE can't import Tkinter. Your Python may not be configured for Tk. So I searched on Stack Overflow (and in some other places) for a solution, I installed python-tk, I rechecked that I have tclsh on the system, but I still can't manage to open idle3.2. Any input would be appreciated.
false
6,320,954
0
0
0
0
Type "idle-python2.6" in the terminal..it worked for me
0
46,374
0
8
2011-06-12T08:27:00.000
python,linux,ubuntu,python-3.x,tkinter
IDLE can't import Tkinter. Your Python may not be configured for Tk
0
4
8
18,475,938
1
0
0
I am running Ubuntu 10.10, and I installed Python 3.2 today. The system is already running Python 2.6. I typed idle3.2 in the terminal and it gave me: IDLE can't import Tkinter. Your Python may not be configured for Tk. So I searched on Stack Overflow (and in some other places) for a solution, I installed python-tk, I rechecked that I have tclsh on the system, but I still can't manage to open idle3.2. Any input would be appreciated.
false
6,320,954
0.024995
0
0
1
you need to install tk or tk-dev packages for ubuntu.
0
46,374
0
8
2011-06-12T08:27:00.000
python,linux,ubuntu,python-3.x,tkinter
IDLE can't import Tkinter. Your Python may not be configured for Tk
0
4
8
8,566,253
1
0
0
Every once in a while I like to take a break from my other projects to try to make a classic adventure text-based-game (in Python, this time) as a fun project, but I always have design issues implementing the item system. I'd like for the items in the game to descend from one base Item class, containing some attributes that every item has, such as damage and weight. My problems begin when I try to add some functionality to these items. When an item's damage gets past a threshold, it should be destroyed. And there lies my problem: I don't really know how to accomplish that. Since del self won't work for a million different reasons, (Edit: I am intentionally providing the use of 'del' as something that I know is wrong. I know what garbage collection is, and how it is not what I want.) how should I do this (And other similar tasks)? Should each item contain some kind of reference to it's container (The player, I guess) and 'ask' for itself to be deleted? The first thing that comes to mind is a big dictionary containing every item in the game, and each object would have a reference to this list, and both have and know it's own unique ID. I don't like this solution at all and I don't think that it's the right way to go at all. Does anybody have any suggestions? EDIT: I'm seeing a lot of people thinking that I'm worried about garbage collection. What I'm talking about is not garbage collection, but actually removing the object from gameplay. I'm not sure about what objects should initiate the removal, etc.
false
6,325,775
0.033321
0
0
1
You're conflating two meanings of the "destroying" idea. The Item should get destroyed in a "gameplay" sense. Let the garbage collector worry about when to destroy it as an object. Who has a reference to the Item? Perhaps the player has it in his inventory, or it is in a room in the game. In either case your Inventory or Room objects know about the Item. Tell them the Item has been destroyed (in a gameplay sense) and let them handle that. Perhaps they'll now keep a reference to a "broken" Item. Perhaps they'll keep track of it, but not display it to the user. Perhaps they'll delete all references to it, in which case the object in memory will soon be deleted. The beauty of object-oriented programming is that you can abstract these processes away from the Item itself: pass the messages to whoever needs to know, and let them implement in their own way what it means for the Item to be destroyed.
1
1,852
0
5
2011-06-13T01:02:00.000
python,oop
Managing Items in an Object Oriented game
0
3
6
6,325,854
1
0
0
Every once in a while I like to take a break from my other projects to try to make a classic adventure text-based-game (in Python, this time) as a fun project, but I always have design issues implementing the item system. I'd like for the items in the game to descend from one base Item class, containing some attributes that every item has, such as damage and weight. My problems begin when I try to add some functionality to these items. When an item's damage gets past a threshold, it should be destroyed. And there lies my problem: I don't really know how to accomplish that. Since del self won't work for a million different reasons, (Edit: I am intentionally providing the use of 'del' as something that I know is wrong. I know what garbage collection is, and how it is not what I want.) how should I do this (And other similar tasks)? Should each item contain some kind of reference to it's container (The player, I guess) and 'ask' for itself to be deleted? The first thing that comes to mind is a big dictionary containing every item in the game, and each object would have a reference to this list, and both have and know it's own unique ID. I don't like this solution at all and I don't think that it's the right way to go at all. Does anybody have any suggestions? EDIT: I'm seeing a lot of people thinking that I'm worried about garbage collection. What I'm talking about is not garbage collection, but actually removing the object from gameplay. I'm not sure about what objects should initiate the removal, etc.
false
6,325,775
0
0
0
0
Assuming you call a method when the item is used, you could always return a boolean value indicating whether it's broken.
1
1,852
0
5
2011-06-13T01:02:00.000
python,oop
Managing Items in an Object Oriented game
0
3
6
6,325,828
1
0
0
Every once in a while I like to take a break from my other projects to try to make a classic adventure text-based-game (in Python, this time) as a fun project, but I always have design issues implementing the item system. I'd like for the items in the game to descend from one base Item class, containing some attributes that every item has, such as damage and weight. My problems begin when I try to add some functionality to these items. When an item's damage gets past a threshold, it should be destroyed. And there lies my problem: I don't really know how to accomplish that. Since del self won't work for a million different reasons, (Edit: I am intentionally providing the use of 'del' as something that I know is wrong. I know what garbage collection is, and how it is not what I want.) how should I do this (And other similar tasks)? Should each item contain some kind of reference to it's container (The player, I guess) and 'ask' for itself to be deleted? The first thing that comes to mind is a big dictionary containing every item in the game, and each object would have a reference to this list, and both have and know it's own unique ID. I don't like this solution at all and I don't think that it's the right way to go at all. Does anybody have any suggestions? EDIT: I'm seeing a lot of people thinking that I'm worried about garbage collection. What I'm talking about is not garbage collection, but actually removing the object from gameplay. I'm not sure about what objects should initiate the removal, etc.
false
6,325,775
-0.033321
0
0
-1
at first: i don't have any python experience, so think about this in a more general way your item should neither know or care ... your Item should have an interface that says it is something destroyable. containers and other objects that care about things that can be destroyed, can make use of that interface that destroyable interface could have some option for consuming objects to register a callback or event, triggered when the item gets destroyed
1
1,852
0
5
2011-06-13T01:02:00.000
python,oop
Managing Items in an Object Oriented game
0
3
6
6,325,868
1
0
0
I am trying to make a file manager in python that looks like GNOME default file manager (nautilus) Because I am developing a FilePane plugin for a python written text editor. I don't know if there is a widget to give me the same look of Nautilus. If not, what widgets can I use to get a nice looking file manager?
true
6,356,190
1.2
0
0
0
I searched GTK API and I found that GTK TreeView does what I want.
0
622
1
0
2011-06-15T10:15:00.000
python,pygtk,glade
PyGTK Glade File Manager
0
1
1
6,441,716
1
0
0
I want to have a table like display on one of panels where the user can fill in data into pre-made columns. I'm not sure what widget will give me this functionality. I want users to be able to edit elements they have already added, and to easily add another element. Any suggestions?
false
6,362,228
0.197375
0
0
3
Look at Grid or ListCtrl to create the columns. I think Grid is a better choice for editing as you can add TextCtrls or the like to the columns.
0
94
0
1
2011-06-15T18:06:00.000
python,wxpython
Looking for a wxpython widget that would let user's fill in data like they would in a table
0
2
3
6,362,267
1
0
0
I want to have a table like display on one of panels where the user can fill in data into pre-made columns. I'm not sure what widget will give me this functionality. I want users to be able to edit elements they have already added, and to easily add another element. Any suggestions?
false
6,362,228
0
0
0
0
Try ListCtrl with TextEditMixin - it's pretty neat and offers keyboard navigation to move between cells.
0
94
0
1
2011-06-15T18:06:00.000
python,wxpython
Looking for a wxpython widget that would let user's fill in data like they would in a table
0
2
3
6,383,556
1
0
0
I'm using python GTK under Gnome (Gnome 3 in Fedora 15). I'd like to catch events when the user double clic on the icon in the tray area. I found that "activate" signals is called when the user do a single clic, but can't find the signal or a proper way to call a method when the user double clic on it. How can I do ? Thanks for your help!
true
6,370,804
1.2
0
0
3
You can't. Gtk+ itself doesn't even know if it was single or double clicked. From the Gtk+ documentation about the ::activate signal: Gets emitted when the user activates the status icon. If and how status icons can activated is platform-dependent. Interestingly Qt knows about this (it has Trigger and DoubleClick). Maybe you can work around this by using ::button-press-event instead and counting it, but I'm not sure this can be called the recommended way. Also, a personal note as a user: I prefer status icons that are activated by a single click.
0
477
0
3
2011-06-16T11:08:00.000
python,gtk,icons,status
gtk.StatusIcon with double click
0
1
1
6,477,243
1
0
0
I am using Qt Designer to set up a simple gui for a program I am writing in which I need to display a column of radio buttons. I want to hide some of the radio buttons (not just disable them) based on whether or not their corresponding port is currently available. The radio buttons are in a group box with a vertical layout, so whenever I hide one of them, the rest of the buttons move apart to fill the space. Is there any way to make it so the buttons will compress towards top of the groupbox instead of autospacing themselves?
true
6,390,066
1.2
0
0
2
Insert a vertical spacer below the bottom-most radio button.
0
437
0
2
2011-06-17T18:21:00.000
python,layout,pyqt4,qt-designer,groupbox
PyQt4 Vertical Layout Autospacing
0
1
1
6,390,326
1
0
0
I need to create a link button (gtk.LinkButton) with an URI to a local file. Does anyone know what is a valid URI format for a local file ? I want to specify a relative folder example: ../some_folder/file_i_need_to_open.txt If this is can't be done, I don't mind putting the file in the same folder as the python source code =) Thank you.
true
6,395,185
1.2
0
0
1
Something like: file:///usr/bin/ is generally used for local URI. But maybe just /usr/bin/ works too. Have you tried it?
0
396
0
0
2011-06-18T09:51:00.000
python,pygtk
How to Specify URI to a local File in PyGtk LinkButton
0
1
1
6,395,227
1
0
0
I am writing a simple top down rpg in Pygame, and I have found that it is quite slow.... Although I am not expecting python or pygame to match the FPS of games made with compiled languages like C/C++ or event Byte Compiled ones like Java, But still the current FPS of pygame is like 15. I tried rendering 16-color Bitmaps instead of PNGs or 24 Bitmaps, which slightly boosted the speed, then in desperation , I switched everything to black and white monochrome bitmaps and that made the FPS go to 35. But not more. Now according to most Game Development books I have read, for a user to be completely satisfied with game graphics, the FPS of a 2d game should at least be 40, so is there ANY way of boosting the speed of pygame?
false
6,395,923
0
0
0
0
You could try using Psyco (http://psyco.sourceforge.net/introduction.html). It often makes quite a bit of difference.
0
29,233
0
15
2011-06-18T12:15:00.000
python,performance,pygame,frame-rate
Any way to speed up Python and Pygame?
0
1
6
6,396,048
1
0
0
I'm getting a Tkinter error even though it was imported and used yesterday. I have a Windows 7 OS and am running Python 2, so I'm not sure what I'm supposed to do at this point. My google-fu is weak today, I can't seem to bring up anything relevant. Any input would be greatly appreciated.
true
6,429,397
1.2
0
0
1
This happens when you most likely have more than one Python installed on your system and you're running the program from a version different from the one you programmed it in. By default, a Python program on your PC will usually be opened in the latest edition of Python.
1
4,656
0
3
2011-06-21T17:25:00.000
python,debugging,import,tkinter,importerror
"ImportError: No module named Tkinter" even though I've used Tkinter programs as recent as yesterday and no substantial changes were made?
0
2
2
6,440,612
1
0
0
I'm getting a Tkinter error even though it was imported and used yesterday. I have a Windows 7 OS and am running Python 2, so I'm not sure what I'm supposed to do at this point. My google-fu is weak today, I can't seem to bring up anything relevant. Any input would be greatly appreciated.
false
6,429,397
0.379949
0
0
4
You may want to check if the version of the Python interpreter used to run the script got changed somehow. import tkinter works in python 3 (instead of Tkinter).
1
4,656
0
3
2011-06-21T17:25:00.000
python,debugging,import,tkinter,importerror
"ImportError: No module named Tkinter" even though I've used Tkinter programs as recent as yesterday and no substantial changes were made?
0
2
2
12,694,818
1
0
0
I'm writing a Python application to parse a list of binary files, aggregate statistics on the data in them, and output results. I can easily output these results as a .tsv file, but this program is being written for the convenience of my coworkers, so I'm trying to have it display the results in a new window to sometimes prevent having to open the file in Excel. Right now I'm basically embedding a Tkinter frame in a scrolled canvas and gridding smaller frames containing labels of the data into the frame. (The smaller frames seem to be necessary to get all the borders to line up with the gridlines; otherwise they are shrinkwrapped to fit the labels) This approach works with upwards of a hundred columns and maybe ten rows. But when I start increasing the number of rows to the hundreds, I start encountering odd problems. The program might become unresponsive, the new window might not display, and all the labels, rather than being drawn in the grid, are all placed in the top left corner of my screen. Since this appears to be a scale-related problem, I'm wondering if I'm simply overwhelming the grid manager with tens of thousands of elements to place. So I have two questions: 1) Could I be running into such limitations, or is the problem elsewhere, and 2) Is there a better way to implement an Excel-like table display in Tkinter that steers clear of these problems?
true
6,431,487
1.2
0
0
2
I wrote a test program to display the data two ways, once using a frame and grid and once drawing text directly on the canvas. Using the frame+grid technique, the performance of 100 rows times 10 columns was quite acceptable. When I bumped that up to 200 rows the performance was more than 2x worse, and by the time I got to 300 rows, performance was unusable. And by that I mean, it took dozens of seconds for the initial display. Once the window appeared, however, the performance was acceptable. Drawing text items directly on the canvas, performance was considerably better. I could display 300 rows by 10 columns and the initial display was almost instantaneous. Performance was still acceptable when I had 1000 rows with 100 columns, taking maybe 2-3 seconds to start up. So, for a large number of cells you're better off drawing them directly on the canvas. This means you'll need to calculate the height of a row yourself, and also do a little math for the columns -- either use fixed width columns or keep track of the widest and then adjust the coordinates accordingly.
0
2,573
0
0
2011-06-21T20:20:00.000
python,performance,grid,tkinter
Size limitations of Tkinter grid manager
0
1
2
6,432,380
1
0
0
I would like to write a Python/wxPython app that implements wx.FileDropTarget. This part is easy. I would also like to show the file icon as it is dragged over the app window and then display a proxy with file icon (and other meta-data, perhaps, like size) within the app window. I would like to implement this on Windows 7. But I am interested in being able to make this work on OS X and Linux as well. I have googled and searched through Python v2.7.1 documentation - but to no avail. I am somewhat new the ways of Windows, so if there is a way to divine a BMP or ICO file that is associated with a file - then I am okay with going that route... Any example code is always appreciated.
false
6,433,574
0.099668
0
0
1
I think there's not only one portable way to accomplish this ... on windows platforms, default icons for file types associations are stored on the system registry (except for executables where the icon is in the exe resources) and on linux platforms it depends on the desktop environment, each one has its own standards ... so i don't think there's an "universal" way to do that.
0
600
0
1
2011-06-22T00:29:00.000
python,windows,filesystems,icons,wxpython
Accessing file meta-data within Python/wxPython
0
1
2
6,433,722
1
0
0
I want to be able to load/download a bunch of resources and notify the user of the file that's currently being loaded, but I can't just draw a frame after each file starts loading because v-sync will wait until it can draw a frame before it continues (bottle-necking the loads to less than 60/second). Is there a way to check whether the device is ready to draw or not (without hacky "has 1/60th of a second passed yet?), so I can perform actions until it's ready? I don't mind if the notification skips over files that finished before it's ready to draw, but I want to maximize the speed of the loads while still being able to notify the user. Also, I'd like to avoid disabling v-sync even temporarily because I don't want to cause a graphic card crippling 300FPS rate if the computer loads really quickly.
true
6,450,283
1.2
0
0
1
You don't specify which version of Direct3D you're using. With D3D9 you can pass D3DPRESENT_DONOTWAIT to your Present() call and it will return D3DERR_WASSTILLDRAWING if the hardware is busy processing or waiting for a vertical sync interval. This means if you have vsync enabled, in your main loop you can just call Present with the DONOTWAIT flag whenever you've loaded a file and load another if it returns WASSTILLDRAWING. Note that you need to get the swap chain and call Present() on the swap chain rather than calling Present() directly on the device to be able to pass this flag to present, or you can set it in the D3DPRESENT_PARAMETERS structure when you create the device or create an IDirect3DDevice9Ex instead of an IDirect3DDevice9 device and call PresentEx() instead of Present(). This doesn't solve the problem of files that take longer than a frame to load however - your frame rate will drop if you have a file that takes a long time to process. A better solution to this problem in my opinion would be to move as much of your IO as possible to another thread (in D3D9 you will still have to create D3D resources on your main thread however) and just pass the name of the file that's currently being processed to your main / render thread to display each time you present a frame.
0
1,246
0
0
2011-06-23T06:45:00.000
direct3d,python-idle,vertical-sync
How can I perform actions while waiting for vertical sync?
0
1
1
6,458,750
1
1
0
What's the best way to detect idle state for a silverlight application? I have read quite a few articles on the net by now and usually they are either for wpf/mobile apps etc. I have created a DispatcherTimer which locks the screen after 5 minutes and it seems that I will have to go to every widget in every screen(my application has around 4-5 screens) and add a mousebuttondown or mouseenter eventhandler to reset this timer. This doesn't seem to be efficient but just adding the handler to the layroot is not helping either. Any helpful suggestions? Thanks
false
6,451,919
0.197375
0
0
2
Handled events will not bubble up to root control. Instead you should use the AddHandler method with handledEventsToo = true.
0
1,573
0
6
2011-06-23T09:25:00.000
silverlight,python-idle,dispatchertimer
idle state detection silverlight 4 application
0
1
2
9,692,923
1
1
0
I wrote a simple sokoban like 2D game in python that I want to clean up. It's done in a sort-of OO way where each object in the game has a Draw function I can call to redraw the screen. It works out nicely since I can loop through each position on the screen and call the object's draw function. I am learning about design patterns, and I really like the benefits of MVC, but I don't see a clean way to separate the draw function each object has from the model to put into the view. Is there a good way to do this? Is this a case where I should not use a MVC design?
true
6,462,967
1.2
0
0
4
MVC can be counter-intuitive sometimes, especially when you're first learning OO and discover that having a "draw" method makes things so organized! Here's an overview of one of many ways you might implement MVC for your game: Model: "Box": box_type, pos_x, pos_y "BoxManager": list(Box) "GameState": box_manager, player_manager, goal_manager, ... "Move": dx, dy Controller: "GameController": check_valid_move(move), move_player(move), is_goal_state(), ... View: "Screen": render() "PlayerRenderer": render() "BoxRenderer": render_box(box), render_all_boxes() Notice how the model is totally self-contained and does not reference the controller or view modules. This is one of the key aspects of MVC. The controller takes player input and manipulates the global game state. And the view looks at the global game state and renders the screen. You don't have to go this route, but it's an option worth understanding and considering.
1
1,166
0
2
2011-06-24T03:20:00.000
python,model-view-controller,oop
MVC Game Design with objects
0
3
3
6,463,049
1
1
0
I wrote a simple sokoban like 2D game in python that I want to clean up. It's done in a sort-of OO way where each object in the game has a Draw function I can call to redraw the screen. It works out nicely since I can loop through each position on the screen and call the object's draw function. I am learning about design patterns, and I really like the benefits of MVC, but I don't see a clean way to separate the draw function each object has from the model to put into the view. Is there a good way to do this? Is this a case where I should not use a MVC design?
false
6,462,967
0
0
0
0
One aspect that I'll just quickly make explicit is that when your model changes, it can't call the view to say "render this change" - because the model shouldn't know about the view(s). Instead the model raises an event to say it has changed, and the view re-renders as necessary on receiving these. The view(s) know about the model, and subscribes to its events, but the model knows nothing about the things receiving the events. As an example, I'm writing an OpenGL app, where the model contains simple normalized polygons and polyhedra, which are nice to work with geometrically, but are not convenient to pass to OpenGL. When the view receives an event saying the model has changed (a shape added or modified) then the view converts these polygons into the denormalised arrays of vertices that can be passed to OpenGL. This is an expensive operation, so the view caches these arrays in its own collection of "what needs to be rendered", and when it renders, it just iterates through this 'view collection', passing each array to OpenGL. So the view is the only code that knows about OpenGL, and is the only code that knows how to convert model state into OpenGL structures.
1
1,166
0
2
2011-06-24T03:20:00.000
python,model-view-controller,oop
MVC Game Design with objects
0
3
3
11,327,596
1
1
0
I wrote a simple sokoban like 2D game in python that I want to clean up. It's done in a sort-of OO way where each object in the game has a Draw function I can call to redraw the screen. It works out nicely since I can loop through each position on the screen and call the object's draw function. I am learning about design patterns, and I really like the benefits of MVC, but I don't see a clean way to separate the draw function each object has from the model to put into the view. Is there a good way to do this? Is this a case where I should not use a MVC design?
false
6,462,967
0
0
0
0
Refactoring your code to conform to MVC would mean creating a "view" (like that represented your screen, and that view would have (for example) a draw method that took the "model" (a python object that contained all of the block states) and rendered that model to the screen. Now perhaps all that draw method would do to render to the screen is call a renderToScreen(screenView) method on every block object. Or you might refactor that draw method into the view if you want to be more "pure".
1
1,166
0
2
2011-06-24T03:20:00.000
python,model-view-controller,oop
MVC Game Design with objects
0
3
3
6,463,038
1
0
0
I have all the characters of a font rendered in a PNG. I want to use the PNG for texture-mapped font rendering in OpenGL, but I need to extract the glyph information - character position and size, etc. Are there any tools out there to assist in that process? Most tools I see generate the image file and glyph data together. I haven't found anything to help me extract from an existing image. I use the gimp as my primary image editor, and I've considered writing a plugin to assist me in the process of identifying the bounding box for each character. I know python but haven't done any gimp plugins before, so that would be a chore. I'm hoping something already exists...
false
6,481,333
0.099668
0
0
1
Generally, the way this works is you use a tool to generate the glyph images. That tool will also generate metric information for those glyphs (how big they are, etc). You shouldn't be analyzing the image to find the glyphs; you should have additional information alongside your glyphs that tell where they are, how big they should be, etc. Consider the letter "i". Depending on the font, there will be some space to the left and right of it. Even if you have a tool that can identify the glyph "i", you would need to know how many pixels of space the font put to the left and right of the glyph. This is pretty much impossible to do accurately for all letters. Not without some very advanced computer vision algorithms. And since the tool that generated those glyphs already knew how much spacing they were supposed to get, you would be better off changing the tool to write the glyph info as well.
0
1,560
0
2
2011-06-26T00:15:00.000
python,opengl,fonts,bitmap,gimp
Tools to extract glyph data from bitmap font image
0
1
2
6,481,428
1
0
0
I'm going to develop a multimedia application which is running mostly on windows. I don't know whether python is a good choice or not and which GUI library (Wxpython or pyqt) is suitable for that. Maybe pyQt is enough(like it). The major features of the application include: Must have a rich GUI, a great look and feel which is fast. Have the ability to play/pause video and audio files with fast seeking ability( seek and play a specific portion of a long media file quickly upon request, CRITICAL FEATURE) Have the ability to control the speed of playback without losing so much quality Can show subtitles for video files Since I'm new to Python world, it's wise to dive straightly into Python 3.x, the problem is that python 3 is fairly new and most of the resources are still based on python 2.x. Will I need to work back on python 2.x? are the required libraries compatible with python 3.x? Thanks
true
6,499,507
1.2
0
0
0
Python 3 doesn't work with wxPython right now. Python 3 does work with pyQT, but it is under GPL, so you will need to buy a license if you do not want to release your software under the GPL.
0
288
0
0
2011-06-27T22:07:00.000
python,user-interface,programming-languages,multimedia
A multimedia-rich application for windows, is Python enough good?
0
1
1
6,499,936
1
0
0
On the wxwidgets docs, I only found the EnableGridLines, which is set to false, removes both the horizontal and vertical lines, what I wish, is to remove only the horizontal lines on the grid. Is there a possible way to do this?
false
6,527,640
0
0
0
0
I agree with Mike. Unfortunately wx.grid.Grid.Get[Col|Row]GridLinePen() isn't hooked to the wxPython level, so you can't override those functions in your code. I had been hopeful that returning None would result in the line not being drawn.
0
656
0
3
2011-06-29T21:45:00.000
python,grid,wxpython,wxwidgets
Remove horizontal grid lines only on wxgrid
0
2
2
6,539,871
1
0
0
On the wxwidgets docs, I only found the EnableGridLines, which is set to false, removes both the horizontal and vertical lines, what I wish, is to remove only the horizontal lines on the grid. Is there a possible way to do this?
false
6,527,640
0.291313
0
0
3
As far as I can tell, you either have all the lines or none of them. Feel free to try cross-posting on the wxPython mailing list to make doubly sure though.
0
656
0
3
2011-06-29T21:45:00.000
python,grid,wxpython,wxwidgets
Remove horizontal grid lines only on wxgrid
0
2
2
6,535,996
1
0
0
I'm new to pyqt and I've been looking for some docs about pyqt and fullscreen mode. but I couldn't find nothing. So here is my question: is there any way to run a PyQT 4 application on fullscreen?
true
6,541,771
1.2
0
0
47
use showFullScreen() on your widget.
0
28,015
0
28
2011-06-30T22:22:00.000
python,pyqt,fullscreen
Fullscreen with pyqt4?
0
1
1
6,541,995
1
0
0
I'm using Tkinter in Python, and trying to create code to run when a text box's value is changed. All the code I find online uses a mysterious tk member of Tkinter widgets, and I can't find any documentation on it! I found it's of type tkapp, but there's no documentation on that either. Where can I find a decent resource which explains to me the workings of this mysterious thing? (Even better, where can I just find documentation on Tkinter? All I can find are tutorials).
false
6,543,413
0
0
0
0
tkapp is the highest "master". If you make a widget on the root window, tkapp is the master of that.
0
2,594
0
5
2011-07-01T03:50:00.000
python,graphics,tkinter
What is Tkinter's tkapp?
0
1
2
32,061,918
1
0
0
I'm working with an API which is distributed as a dll/so file that I need to dynamically link with my python program. To accomplish this, I want to use Cython. I have been able to, in the past, link with the dll statically. This works well, except that the API comes in four different flavors, with theoretically infinitely more to come and the users should be able to compile them with whatever name they want (Kinda like a plugin system). Because of that, I can't just make an so/pxd file that statically links with just one library, or even links with a selection of them. What I need is to be able to pass the so/dll name into the Cython code and have it "import" it. I know this can be done with ctypes via ctypes.cdll.LoadLibrary, but is this kind of thing possible in Cython? Am I going to have to use ctypes to do this?
true
6,546,310
1.2
0
0
2
I assume you are talking about writing C modules here. If so yes you can. I don't know what the equivalent on Windows is, but in Linux you can use dlopen and friends. There is a man page for it, and several web sites documenting it. Try this link "http://linux.die.net/man/3/dlopen" it provides you with a nice example near the bottom of the page. This is doing the same thing as what ctypes does, in fact I think this might even be what ctypes uses.
1
981
0
2
2011-07-01T09:46:00.000
python,cython
Cython: Dynamically linking with a dll/so
0
1
1
6,591,378
1
0
0
I'm attempting to convert a Python application I coded using the cmd module into a gui. Initially, I came across EasyGui. But after giving it a try, I find that it is very limited, the gui screens are not consistent, and overall not easy on the eyes. I read about IronPython (Python + .NET), but cannot find adequate documentation on it. Before I order a book from Amazon on IronPython (as this seems the most legitimate), does anyone know of a decent gui alternative for Python? Thanks!
false
6,566,264
0
0
0
0
The best GUI's for Python are tkinter, Qt (PyQt), and wx (wxPython). Search any of those terms to learn more.
0
1,559
0
0
2011-07-03T23:52:00.000
python,user-interface
Is there a preferred Python gui to use
0
2
3
6,566,268
1
0
0
I'm attempting to convert a Python application I coded using the cmd module into a gui. Initially, I came across EasyGui. But after giving it a try, I find that it is very limited, the gui screens are not consistent, and overall not easy on the eyes. I read about IronPython (Python + .NET), but cannot find adequate documentation on it. Before I order a book from Amazon on IronPython (as this seems the most legitimate), does anyone know of a decent gui alternative for Python? Thanks!
true
6,566,264
1.2
0
0
5
Tkinter is in the standard library, works on all platforms, and is fairly simple and lightweight, but it looks a bit clunky. WxPython tries to use platform widgets, so it looks a bit better, but it's a separate library. On Linux, I still find it doesn't look quite right. PyQt is a large, powerful framework - it looks good, and you can do a lot with it, but it's more complex and a larger install. There are plenty of others, but those are probably the most popular.
0
1,559
0
0
2011-07-03T23:52:00.000
python,user-interface
Is there a preferred Python gui to use
0
2
3
6,566,327
1
0
0
i have a wxlistbox in a class and i want to update the data inside the listbox from a different class.Is i possible to reload the class while leave the control from another class?if yes ,how? eg: i have two classes,Class A and Class B.In class A there is a wxlistbox.while starting the program class A initilise the wxlistbox and bind some values.when a button inside class A clicked it call another frame class B.while close the frame B the wxlistbox inside class A should update. My question is how to refresh listbox while close the frame B?
true
6,581,744
1.2
0
0
1
I would use the SetItems() method, which according to the docs does the following: "Clear and set the strings in the control from a list". Edit: myListCtrl.SetItems(ListOfStrings) That will replace all the items in the control with whatever is in the list.
0
169
0
0
2011-07-05T11:13:00.000
python,wxpython
how to update a wxlistbox from a different class?
0
1
1
6,584,095
1
0
0
I am building an application for Android. It will interface with some C++ libraries using Android NDK through JNI. There are also some libraries that are written in Python that I want to call from my Android application (e.g. NTLK). How can I do that? Please note that SL4A (Scripting Layer for Android) is something different. It allows you to build an application using a scripting language like Python, Lua etc. In my case the application will be in Java but will need to call code that has been written in Python. Is this possible in an elegant way?
false
6,596,568
0.197375
0
0
1
I recommend putting the NLP code into web services on a Linux server and calling those from android. This is quite straight forward in a framework like django.
0
5,930
0
7
2011-07-06T12:44:00.000
android,python,embed,android-ndk,sl4a
Want to use Python Libraries in Android
0
1
1
15,260,692
1
0
0
In a pygame application window, the minimize, resize and close buttons are present. Is there a way to disable the close(X) button?
true
6,619,923
1.2
0
0
6
I don't think there is, because some window managers don't give you the ability to remove the close button. But you can write an event handler such that the close button does whatever you want, including nothing. Why do you want to prevent the user from closing? If it's just a matter that you would rather provide an in-game "quit" button that confirms and/or saves before quitting, you can perform the same task when the user hits the close button.
0
1,851
0
4
2011-07-08T04:17:00.000
python,pygame
how to disable the window close button in pygame?
0
2
2
6,619,966
1
0
0
In a pygame application window, the minimize, resize and close buttons are present. Is there a way to disable the close(X) button?
false
6,619,923
0
0
0
0
Just for the record, another option would be to pass the following argument to the set_mode() method call: pygame.display.set_mode(..., flags = pygame.NOFRAME) This however makes the whole frame go away, including the top strip to move the window around and the other buttons, such as minimize, so it's rather overkill for just getting rid of the X button.
0
1,851
0
4
2011-07-08T04:17:00.000
python,pygame
how to disable the window close button in pygame?
0
2
2
49,826,543
1
0
0
I'm trying to use the beforeInsert() signal emitted by the QSqlRelationalTableModel in PyQt. However, even after I make edits to the model, the slot connected to the signal does't run. When exactly is the beforeInsert() signal emitted? Could someone show a working example of the use of beforeInsert(), or beforeUpdate() for that matter?
false
6,634,523
0.379949
0
0
2
The documentation says "This signal is emitted by insertRowIntoTable() before a new row is inserted into the currently active database table". So it sounds like the signal is only emitted when insertRowIntoTable() is called, and not for any other type of model edit.
0
99
0
0
2011-07-09T11:46:00.000
python,pyqt
PyQt beforeInsert() signal
0
1
1
6,644,954
1
0
0
Is there any way to design a rounded corner TextCtrl widget? Actually I am new to wxPython and I am used to swing. Like in swing, is their any way in wxPython too to customize the border of the widgets?
false
6,651,098
0
0
0
0
wxPython uses native widgets for the most part. If they don't have a rounded version, then the answer is No. However, wxPython supports custom widgets, so you could create your own text control with whatever features you want.
0
764
0
0
2011-07-11T13:50:00.000
python,swing,wxpython
Rounded corner border in wxPython
0
1
1
6,652,801
1
0
0
In wxPython, there is a ListCtrlAutoWidthMixin which makes sure that the last column in the list uses up all the space available to the list, even when it resizes. However, I have had problems with the native wxListCtrl on Windows that mean I want to use a different list, like the HyperTreeList that is new in 2.8.12. This does not seem to have any easy way of doing what the ListCtrlAutoWidthMixin did. Is there a way? Is there an available mixin that I can use (I can presumably copy the existing mixin, but if someone has already done the work I would prefer to use that).
false
6,652,365
0
0
0
0
Possibly the best answer would have been to use the UltimateListCtrl from the same library, which shares the same API. However, this too seems to have problems. Still investigating.
0
249
0
1
2011-07-11T15:15:00.000
python,listview,wxpython
Automatically using maximum column width in wxPython's HyperTreeList
0
1
1
6,666,289
1
0
0
So, Iv'e got a pygame application. Right now, it takes a command line argument to specify which display to show the main screen on. However, I'm running it on windows, where it's hard to specify command line input to a graphical application. So, I'd like to have a very very very simple dialog box which pops up, prompts the user for an integer, then closes. My research has shown that pygame can't do a dialog box like this, and I can't get input in a pygame window, because the program doesn't know yet which monitor to draw the pygame window to. So, my question is, what is the simplest way to create a dialog box for input? I've looked into wx and tkinter. I could use either of them, but what I'm wondering is, but I want to import the least number of extra toolkits. i.e. I don't want to have to start the wx main loop just so I can make 1 dialog, then close it, then start a whole new pygame window. I know how to do this in wx, so I'm mostly looking for advice/ideas as to which toolkit would be simplest, as opposed to instruction on how to actually do it (though that's always nice too).
false
6,656,750
0.066568
0
0
1
Since tkinter is built into Python, it might be better. I prefer wx, but if you just want a few dialogues, tkinter is fine. You could also just try raw_input('type "1" for low res, "2" for high res'). I think it brings up a dialog window in Windows.
0
2,527
0
1
2011-07-11T21:22:00.000
python,user-interface,tkinter,pygame
Simplest way to get initial text input in pygame
0
1
3
6,657,099
1
0
0
I am trying to install pywin32 for Python 2.6. I have python installed but it's not in the regular c: drive but on the d: drive . The pywin32 installer does not find it and I cannot give the custom path to it. I checked, thepython folder is the path. Is there a workaround this issue ?
false
6,662,536
1
0
0
8
I had the same problem: On 64 bit Windows, 32 bit apps are being registered under: [1] HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Python I reckon the installer is expecting to find Python in: [2] HKEY_LOCAL_MACHINE\SOFTWARE\Python With regedit and local admin rights, you can export a .reg file of [1], remove all the "Wow6432Node\" you find, then import it as [2]
1
45,238
0
7
2011-07-12T10:10:00.000
python,pywin32
Problem installing pywin32
0
4
11
23,008,561
1
0
0
I am trying to install pywin32 for Python 2.6. I have python installed but it's not in the regular c: drive but on the d: drive . The pywin32 installer does not find it and I cannot give the custom path to it. I checked, thepython folder is the path. Is there a workaround this issue ?
false
6,662,536
0.036348
0
0
2
I had the same issue on Windows 10 64 bit with Python 3.6. It is installed for all users (I guess it uses a different registry hive in case it is installed for current user only). The problem was that pywin32-220.win32-py3.6.exe searches in registry for HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Python\PythonCore\3.6 whilst python 3.6 setup created HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Python\PythonCore\3.6-32. Note the different endings! Exporting the 3.6-32 registry to .reg file, modifying the paths to 3.6 and reimporting the file registry again fixed the problem for me.
1
45,238
0
7
2011-07-12T10:10:00.000
python,pywin32
Problem installing pywin32
0
4
11
41,378,346
1
0
0
I am trying to install pywin32 for Python 2.6. I have python installed but it's not in the regular c: drive but on the d: drive . The pywin32 installer does not find it and I cannot give the custom path to it. I checked, thepython folder is the path. Is there a workaround this issue ?
true
6,662,536
1.2
0
0
15
From the pywin32 README If the installation process informs you that Python is not found in the registry, it almost certainly means you have downloaded the wrong version - either for the wrong version of Python, or the wrong "bittedness". Are you sure you got the right version for your python and your cpu architecture? If you did and that did not work, you might try building from source, I think there might be a command line flag to allow you to specify the python installation location.
1
45,238
0
7
2011-07-12T10:10:00.000
python,pywin32
Problem installing pywin32
0
4
11
6,662,762
1
0
0
I am trying to install pywin32 for Python 2.6. I have python installed but it's not in the regular c: drive but on the d: drive . The pywin32 installer does not find it and I cannot give the custom path to it. I checked, thepython folder is the path. Is there a workaround this issue ?
false
6,662,536
0
0
0
0
I ran into this exact problem, but it seemed to me that my situation was a bit different and besides, I didn't want to have to use a registry hack. So I started to post a new question. Here's what I was going to write: I have both 64-bit and 32-bit versions of Python 3.7 installed on my Windows 7 machine. The 64-bit version is installed in C:\Python37 and the 32-bit version is installed in C:\Python37-32. I have the pywin32 package installed in the 64-bit version but not in the 32-bit version. When I start a command window, switch to C:\Python3y-32, and run "pip install pywin32", I am told that it is already installed in C:\Python37. Yes, I know that. I want it installed somewhere else. I tried downloading a wheel file and installing that, with the same result. I tried renaming my C:\Python37 folder to "C:\Python37 64 bits" and renaming C:\Python37-32 to C:\Python37, but the pip gave me a fatal error: Fatal error in launcher: Unable to create process using '"c:\python37-32\python.exe" "C:\Python37\Scripts\pip.exe" install "c:\users\\downloads\ pywin32-223-cp37-cp37m-win32.whl"' (line breaks added for readability) But then I looked again at that error message and realized that the quoted string is a command. I copied that string, switched to the C:\Python37-32 folder in my command window, pasted the string, removed the reference to C:\Python37, and ran it. No problem.
1
45,238
0
7
2011-07-12T10:10:00.000
python,pywin32
Problem installing pywin32
0
4
11
55,397,320
1
0
0
I'm a self-taught programmer who jumped into Python as my first language about 7-8 months ago. I'm fairly solid at making things work, though my foundational knowledge is limited thanks to my questionable choice in college to not study computer science. Beyond Python, I'm not really familiar with C or other lower level languages. I would like to teach myself Objective C as a foray into programming iPhone apps (as a hobby initially). I initially want to create relatively simple utility apps (I think they are relatively simple, at least). Could any one give me a guess as to how long it might take me to pick up Objective C and actually produce a semi-decent app? If time is of the essence, should I just scrap it and go with HTML5? I pick things up fairly fast but, again, my background in Comp Sci is really limited. Sorry if this question is a bit too general and thanks for any insight!
false
6,666,499
0.039979
1
0
1
You should learn both, Objective-C and HTML5. HTML5 isn't very difficult to grasp even if you don't have any experience.
1
5,620
0
8
2011-07-12T15:11:00.000
iphone,python,objective-c,c
Python to Objective C (Expected Learning Curve)
0
2
5
6,666,567
1
0
0
I'm a self-taught programmer who jumped into Python as my first language about 7-8 months ago. I'm fairly solid at making things work, though my foundational knowledge is limited thanks to my questionable choice in college to not study computer science. Beyond Python, I'm not really familiar with C or other lower level languages. I would like to teach myself Objective C as a foray into programming iPhone apps (as a hobby initially). I initially want to create relatively simple utility apps (I think they are relatively simple, at least). Could any one give me a guess as to how long it might take me to pick up Objective C and actually produce a semi-decent app? If time is of the essence, should I just scrap it and go with HTML5? I pick things up fairly fast but, again, my background in Comp Sci is really limited. Sorry if this question is a bit too general and thanks for any insight!
false
6,666,499
0
1
0
0
Well when i started progamming for Objective-c i was well known in Java, but nothing close to C/Objective-c. It took me around 1 month to learn the basics (using tutorials etc). There are some really good tutorials on iTunes (search for Objective-c seminar). I also used a couple of pdf's to use them as backup while making my first app. That helped alot!
1
5,620
0
8
2011-07-12T15:11:00.000
iphone,python,objective-c,c
Python to Objective C (Expected Learning Curve)
0
2
5
6,666,588
1
0
0
I'm trying to use Qt Designer and pyside-uic mydesign.ui > design.py however, this program doesn't exist. I looked in site packages under python 2.7, and I see: pyside-lupdate.exe pyside-rcc.exe and a bunch of other programs, but there is no such thing as pyside-uic.exe ... why ?? Why is it missing from the installation package? Where do I get it?
true
6,684,180
1.2
0
0
8
You should see a /Python27/Scripts/pyside-uic.exe. But I'm wondering why it's not visible (not executable). Maybe it's a packaging problem (permissions, etc). You could try to call it using the complete path.
0
25,947
0
9
2011-07-13T19:03:00.000
python,qt,pyside
Where is pyside-uic?
0
1
6
6,685,002
1
0
0
I have been searching for a way to set the tab order in a tkinter application, that I have been working on. Currently the default order seems to be working from top-down, but it requires using CTRL + Tab to cycle through the controls. Is there any way to customize the order and, more so, change the CTRL + Tab to just Tab?
false
6,687,108
0
0
0
0
I've been searching for ways to skip some widgets while tabbing and found in tkinter's tk_focusNext function description the following: "A widget is omitted if it has the takefocus resource set to 0." you can set takefocus on widget initialization as an argument.
0
12,387
0
11
2011-07-13T23:59:00.000
python,python-3.x,tabs,tkinter
How to set the tab order in a tkinter application?
0
1
2
69,530,509
1
0
0
I have trouble using PySide in Eclipse. I installed py26-pyside using macports and added /opt/local/var/macports/software/py26-pyside/1.0.4_0/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/PySide to PYTHONPATH But I got the above import error. What am I missing? Thanks
true
6,721,266
1.2
0
0
1
Add /opt/local/var/macports/software/py26-pyside/1.0.4_0/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages to PYTHONPATH instead of what you have added.
0
8,855
0
0
2011-07-17T00:58:00.000
python,pyside
ImportError: No module named PySide.QtCore
0
2
2
6,721,303
1
0
0
I have trouble using PySide in Eclipse. I installed py26-pyside using macports and added /opt/local/var/macports/software/py26-pyside/1.0.4_0/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/PySide to PYTHONPATH But I got the above import error. What am I missing? Thanks
false
6,721,266
0
0
0
0
Running Linux, I had the same problem and I don't use PYTHONPATH. Simpler to put /usr/local/lib/python2.6/site-packages in a file called /usr/lib/python2.6/site-packages/local.pth. It's pure python so it should work on other systems. The instructions in site.py are misleading.
0
8,855
0
0
2011-07-17T00:58:00.000
python,pyside
ImportError: No module named PySide.QtCore
0
2
2
6,988,124
1
0
0
I am just newbie to python and now, I am writing an interface in Nokia n79 phone. My question is that is it possible to install PyQt4 in nokia n79 or possible to run PyQt4 in Nokia n79. If yes, how? Is there anyway that I could take as a reference or take as an example.
true
6,736,179
1.2
0
0
0
There are python packages for symbian, look for python for S60. It's an open source project. Download the sis file to your phone and install it... good luck.
1
170
0
0
2011-07-18T16:32:00.000
python,user-interface,mobile,pyqt4
PyQT4 installation in nokia n79
0
1
1
6,737,107
1
0
0
I have a project in Python 2.7 and wxPython. I have both IDLE and Boa Constructor available as IDEs. I need to change one or more properties of a GUI object, such as a button, at run time - especially size, location, and text (the latter in buttons and labels). How do I change these properties at run time? Mind you, I'll be using absolute position with most GUI objects.
false
6,736,195
0.099668
0
0
1
Changing the widget's label or value are simple things. You can probably change a widgets location if you are using absolute positioning, but I think that would be counter-intuitive for the user. I know I wouldn't want my Close button to change locations all the time. I think you can set the size using its SetSize() method, but that might require a refresh. It would take you about 10-15 minutes to actually try this yourself.
1
249
0
0
2011-07-18T16:34:00.000
python,properties,wxpython,runtime,wxwidgets
Change an object's properties at run time?
0
1
2
6,737,329
1
0
0
I'm new to programming and thought Python would be a good language to learn. Most of the tutorials I found were 2.7 based so I started to learn using that version. I've recently found a tkinter tutorial that I'd like to try out but I'm having a problem. If I run a script it will use Python 2.7 which contains Tkinter and not tkinter. This problem made me think, how can I get my two versions to co-exist so I can program in both 2.x and 3.x?
false
6,737,694
0
0
0
0
It depends on what you are trying to do. You can have them coexist because 3.2 is backwards-compatible. Now you can install both versions on your computer 3.2 and 2.7, but 3.2 unfortunately will have to be used in IDLE....ugh.... Just install both and then depending on which one you want to use. Run that IDLE for either one or the other. Now if you are meaning that you want more stable version that can be professionally done, go with 2.7 ( I have done otherwise, but if you run into problems 2.7 is more supported. If you want the more cutting edge stuff, go with 3.2. Either one you go with works with about eveyrthing. If it doesn't, give it a month or two and the rest of the world will catch up.
1
15,701
0
10
2011-07-18T18:40:00.000
python
How to I get Python 2.x and 3.x to co-exist?
0
1
5
6,738,871
1
0
0
How can I use MonkeyRunner to switch the screen mode(Portrait mode and Landscape mode)?
false
6,741,863
0.066568
0
0
1
There is a indirect way,you can toggle between portrain & landscape, but only the setting page.Steps:- 1.Disable auto-rotate screen option in settings page,keep the same page open. 2.Keep device in horizontally(It wont go to landscape mode as auto rotate is disabled 3.Get coordinates of disable/enable by enabling 'show pointer location' 4.touch the cordinates using monkeyrunner-it will goto landscape,touch again it will goback to portrait.
0
1,576
0
3
2011-07-19T03:01:00.000
android,python,monkeyrunner,monkey
Switch the screen mode with MonkeyRunner?
0
3
3
11,164,138
1
0
0
How can I use MonkeyRunner to switch the screen mode(Portrait mode and Landscape mode)?
false
6,741,863
0
0
0
0
If its a physical device then I do not know of a way to change the screen mode without actually physically putting the device on its side.
0
1,576
0
3
2011-07-19T03:01:00.000
android,python,monkeyrunner,monkey
Switch the screen mode with MonkeyRunner?
0
3
3
6,820,953
1
0
0
How can I use MonkeyRunner to switch the screen mode(Portrait mode and Landscape mode)?
false
6,741,863
0.066568
0
0
1
There is no such way.
0
1,576
0
3
2011-07-19T03:01:00.000
android,python,monkeyrunner,monkey
Switch the screen mode with MonkeyRunner?
0
3
3
8,223,351
1
0
0
I can't find anything in the docs. All the code I find is messy and all over the place; all I want to do, is have a table take up the whole frame, and have 6 columns; ID Name Author Type Tags More Info The "More Info" column should have a button, which will call a function with the ID column as param. How would I do this? I want to be able to "fill" this table using an array, with each row
true
6,749,250
1.2
0
0
0
Have you thought about using a ListCtrl instead? I think that might work better. I especially like the ObjectListView widget, which is a nice object oriented wrapper of the ListCtrl. Note that neither the grid nor the ListCtrl really support buttons in their cells, although the grid might work better by using a custom renderer. On the other hand, there's a new widget called the UltimateListCtrl that supports putting ANY widget anywhere in it, so that's an option.
0
1,980
0
0
2011-07-19T14:55:00.000
grid,wxpython
wxPython Tables to display data on full frame
0
1
1
6,750,499
1
0
0
Title says it all.I can't find a way to do it... .Refresh() doens't do anything, other than crash the program. The situation I'm in, is that I have a frame which is launched from the "main" frame. This frame makes changes to the "main" frame's menu bar and panel. What can I call to refresh the main frame, from the second frame?
true
6,750,717
1.2
0
0
0
This one could be done with pubsub. Have the second frame publish a message to the first frame telling it to refresh. I actually think you'll want to use Layout() though. That's what I usually use when I remove or add visible elements. You shouldn't need to Refresh() a menu when removing items from it. At least, the example in the wxPython demo doesn't do that.
0
1,371
0
0
2011-07-19T16:37:00.000
wxpython,refresh,frames
wxPython refresh frame
0
1
1
6,751,443
1
0
0
I have a list L of objects of my class A. This class implements __str__/__repr__, so each object has it's own string representation (not necessary unique). I have a GUI in pygtk, where I have a TreeView widget with only one column. I want to populate it with string representations of the objects in L, but then I want to get selected items as objects, not as string. Is there a way to make TreeView to store list of objects, but display them as stings? If not, then what is the best way to know what objects are selected in the TreeView? The problem also is that depending on some conditions I can populate TreeView not with the whole L, but with some sublist of it, and so indexes of items in TreeView won't correspond to ones in L.
false
6,752,146
0
0
0
0
If the strings are unique you can use a dictionary to link the strings with the objects by using the strings as keys. In this case you can find the objects by its string.
0
2,143
0
6
2011-07-19T18:24:00.000
python,pygtk,gtktreeview
Custom objects in ListStore/TreeStore
0
1
3
6,755,133
1
1
0
I have a button on a new form. When this button clicked I need a show some information on new form using label /or other component/. How to do it in OpenERP 6? I don't have any idea. Please give me a hand. thanks.
false
6,755,995
0
0
0
0
are you trying to raise any kind of error message or you want to have confirmation ? if you want to raise exception, then it's possible , check in the addons/account.py you'll find something that you are looking for.
0
103
0
0
2011-07-20T01:24:00.000
python,openerp
Dynamically create a message
0
1
2
6,854,128
1
0
0
I have a Python GUI that uses Tkinter. I have to SSH into another place to get data. I start a new thread to do this so that the GUI doesn't hang. During this time, I want to pop up a screen that lets the user know it is loading. Once the program is finished getting the data, I want to close the loading screen. What must I do to have my main loop recognize that the thread is done? I've tried to use that thread to close the loading screen that exists in the main loop, but then I discovered that doesn't work. I have seen some producer consumer models that don't use GUIs, and they have while loops. This doesn't help me though. I also don't want to download and install other packages, but imports are ok. Thank you for your help!
true
6,764,217
1.2
0
0
0
Have your thread set a flag when it is done. Have the GUI periodically check for that flag and dismiss the window when it is set. You can check for the flag by creating a function that checks for the flag, and if it's not set it uses after to have itself run again a few hundred ms later. The window won't go away immediately after the thread exits, but as long as the lag isn't more than a couple hundred ms the user will never notice.
0
163
0
0
2011-07-20T15:13:00.000
python,multithreading,user-interface,consumer,producer
How do I close a loading screen right when the other thread is finished in Python using Tk?
0
1
1
6,766,383
1
0
0
For those of you who have written fairly complex PyQt applications, what tips and tricks would you offer for speeding up your applications? I have a few examples of where my program begins to slow down as it grows larger: I have a 'dashboard' written that is destroyed and re-created when a user clicks on an item in a TreeWidget. What would be a better way to have a modular interface where clicking an item in the TreeWidget changes the dashboard, but doesn't require destroying a widget and recreating it. Each dashboard also loads an image from a network location. This creates some slowdown as one navigates around the application, but after it's loaded into memory, 'going back to that same dash' is faster. Is there a good method or way to run a thread on program load that maybe pre-loads the images into memory? If so, how do you implement that? When you have a large variety of dashboard items and data that gets loaded into them, do you guys normally thread the data load and load it back in which each thread completes? Is this viable when somebody is browsing around quickly? Would implementing a kill-switch for the threads such that when a user changes dashboards, the threads die work? Or would the constant creation and killing of threads cause some sort of, well, meltdown. Sorry for the huge barrage of questions, but they seemed similar enough to warrant bundling them together.
true
6,764,329
1.2
0
0
8
I'm not sure if this is exactly the same thing you are doing, but it sounds similar to something I have in some apps, where there is some list of custom widget. And it does significantly slow down when you are creating and destroying tons of widgets. If its an issue of lesser amounts of total widgets, but just being created and deleted a lot, you can just create the widgets once, and only change the data of those widgets as information needs to be updated... as opposed to creating new widgets each time the information changes. That way you can even change the data from threads without having to worry about creating widgets. Another situation is where you are displaying a list with custom widgets and there are a TON of results. I notice it always slows down when you have 1000's of custom widgets in a list. A trick my co-worker came up with was to have a fake kind of list where it is using a static number of slots in the display. Say, it shows 10 slots in the view. The scrollbar doesn't really scroll down across MORE widget...what it does is scrolls the DATA through the 10 visible widgets. You can a crazy performance increase doing that. But only if it is an acceptable display style for your application.
0
3,849
0
6
2011-07-20T15:21:00.000
python,optimization,pyqt
Optimizing your PyQt applications
0
2
2
6,821,582
1
0
0
For those of you who have written fairly complex PyQt applications, what tips and tricks would you offer for speeding up your applications? I have a few examples of where my program begins to slow down as it grows larger: I have a 'dashboard' written that is destroyed and re-created when a user clicks on an item in a TreeWidget. What would be a better way to have a modular interface where clicking an item in the TreeWidget changes the dashboard, but doesn't require destroying a widget and recreating it. Each dashboard also loads an image from a network location. This creates some slowdown as one navigates around the application, but after it's loaded into memory, 'going back to that same dash' is faster. Is there a good method or way to run a thread on program load that maybe pre-loads the images into memory? If so, how do you implement that? When you have a large variety of dashboard items and data that gets loaded into them, do you guys normally thread the data load and load it back in which each thread completes? Is this viable when somebody is browsing around quickly? Would implementing a kill-switch for the threads such that when a user changes dashboards, the threads die work? Or would the constant creation and killing of threads cause some sort of, well, meltdown. Sorry for the huge barrage of questions, but they seemed similar enough to warrant bundling them together.
false
6,764,329
0.099668
0
0
1
Are you using QNetworkAccessManager to load you images? It has cache support. Also it loads everything in background with finishing callbacks. I don't really understand what your dashboard is doing. Have you think about using QWebkit? Maybe your dashboard content is easy to be implemented in HTML? PS. I don't like threads in Python and don't think they are good idea. Deferred jobs delegated to Qt core is better.
0
3,849
0
6
2011-07-20T15:21:00.000
python,optimization,pyqt
Optimizing your PyQt applications
0
2
2
6,774,281
1
0
0
I'm using Python 2.7, PyGTK 2.24, and Glade 2.8.0. I'm trying to set an image to (stretch to) fill all of the given space, but I cannot find the properties to do that. Furthermore, I may need to shrink images to fit sometimes as well. How do I do those two things in Glade?
true
6,795,169
1.2
0
0
0
Glade does not allow for stretching images. This must be done in code, by scaling the pixbuf, creating a pixmap and mask from it, and then creating the image from the pixmap.
0
238
0
1
2011-07-22T19:37:00.000
python,image,pygtk,glade
Set Image to Fill PyGTK
0
1
1
7,046,931
1
0
0
This is my first post to stack overflow. I've been lurking this site for information for years, and it's always helpful, so I thought that I would post my first question. I've been searching for some similar examples, but can't seem to find anything. Ultimately, I'm trying to write a simple text ui for finding false positives and false negatives in a text extraction program. The false positive module is a simple yes/no selection, and displaying colored text and using getch() is easy enough. The False negative portion however, is a becoming difficult. So this is what I want to do: Display a string onto the screen (forget scrolling for now.... ugh) It will only be a string with no newlines. The user sees the text, and pushes 'h' to enter highlight mode. The user can then control the cursor to move it over a portion of the text (still displayed), and select 'v' to begin highlighting (I trying to make this as close to vi as I can) The user then uses control keys (arrows, hjkl) to move the cursor from a starting point to and end point, highlighting the text on the way. This highlighted portion should be a word which is a false negative The user presses some key ('y' probably), and the selected text is colored, or stays highlighted, and the highlighted text is save to some variable that I'll handle later. The user exits highlight mode and proceeds. Any ideas to even START? I'm trying simple things like keeping text on the screen and moving the cursor around, but to no avail. I'm aware of the curses.textpad.TextBox() module, but it performs editing like insertion and deletion, which I don't want to do. Perhaps there is a way to disable it. I have other questions, but I'll keep this specific for now. Thanks!! Neal Edit: To be more specific, I'm not looking for help writing the whole program, just help moving the cursor over displayed text, highlighting it, and selecting it and saVing it in a variable.
false
6,807,808
0
0
0
0
I don't know anything about ncurses, but using Tkinter or one of the other GUI toolkits, it could be done with a canvas. You would first set the scroll region, then bind the "h" key so it sets a highlight variable to True, bind a mouse click to a function that retrieves the location to start, bind the left and right arrows to move left or right one letter, and move the cursor and reverse the colors of the next letter as well as keep track of how many letters you are from the starting point, which also tells you the end location, and bind "y" to copy the text. It is not as complicated as it might seem as each part is a fairly simple function. All of this would of course depend on the font size, and I would suggest displaying the text with a fixed font so each letter occupies the same width. Once again, I do not know ncurses, but it would be similiar with any toolkit. If you can work it around so that the user can select one entire line with a mouse click, it makes the coding much easier. Post back with some code if you do indeed decide to go with Tkinter or wxPython and want some additional help.
1
9,844
0
8
2011-07-24T15:44:00.000
python,ncurses,tui
Highlighting and Selecting text with Python curses
0
1
2
6,808,886
1
0
0
the subject says it all: is it possible to take an image present in the clipboard and save it to file under Tkinter?
false
6,817,600
0
0
0
0
Well tkinter uses the PIL for most of its advanced image stuff, in which case this problem is quite simple: Just use Image.frombuffer(mode, size, data) with the bytebuffer representing the image and then save it ala im.save(filename)- if you want a special format you can also specify it. If you want to do it without the PIL, I don't think tkinter offers that kind of functionality out of the box, its image support is extremely limited in itself.
0
951
0
0
2011-07-25T14:23:00.000
python,tkinter
save the image in the clipboatd - in Python/Tkinter
0
1
2
6,818,171
1
0
0
How can I disable a wxFrame from being resized by the user? If there's a flag to put in when creating the frame, what is it?
false
6,829,853
0.066568
0
0
1
You can use SetSizeHints (or SetMaxSize and SetMinSize) to restrict the maximum and minimum sizes or th
0
16,096
0
11
2011-07-26T12:16:00.000
resize,wxpython,frame
wxPython Disable Frame Resizing
0
1
3
6,829,965
1
0
0
i am trying to install pygtk on my mac which then asked me to install pygobject which then asked me to get gobject-introspection . the problem i have in this installation is while configuring it shows this error : checking for FFI... no checking for ffi.h... configure: error: ffi.h not found please do help me with this as i need to get gtk . /usr/include/ffi->location of ffi.h thanks in advance
false
6,864,484
0
0
0
0
ffi.h is provided by the package libffi-dev, which is actually from the gcc source package. and most probably it's available for linux.
0
2,065
0
0
2011-07-28T19:22:00.000
python,pygtk,gobject,pygobject
problem with configuring gobject-introspection for pygobject and pygtk
0
1
3
6,864,549
1
0
0
I'm not sure on how to articulate this... I have a Tkinter window, and I need to hide half of this window when a button is pressed. However, I need the left-most side to be hidden, so that the window is now half the size it originally was, and shows the right half of the original window. All of Tkinter's resize functions span from the left side of the window. Changing the geometry values can only show the left side whilst hiding the right; I need the inverse. Does anybody know how to go about doing this? (I don't want the user to have to drag the window border, I need the button to automate it). Specs: Python 2.7.1 Tkinter Windows 7
false
6,870,118
0.132549
0
0
2
You can use right-anchored geometry specifications by using a minus sign in the right place: 123x467-78+9 However, I don't know if this will work on Windows (the above is an X11 trick, and I don't know if it is implemented in the platform-compatibility layer or not); you might have to just calculate the new position given the projected size of the left side and use that.
0
1,136
0
0
2011-07-29T07:51:00.000
python,resize,tkinter,tk
Resize Tkinter Window FROM THE RIGHT (python)
0
2
3
6,870,304
1
0
0
I'm not sure on how to articulate this... I have a Tkinter window, and I need to hide half of this window when a button is pressed. However, I need the left-most side to be hidden, so that the window is now half the size it originally was, and shows the right half of the original window. All of Tkinter's resize functions span from the left side of the window. Changing the geometry values can only show the left side whilst hiding the right; I need the inverse. Does anybody know how to go about doing this? (I don't want the user to have to drag the window border, I need the button to automate it). Specs: Python 2.7.1 Tkinter Windows 7
false
6,870,118
0
0
0
0
My IT teacher had a suggestion: Add a Scrollbar out of sight, and after resizing the root window, force the scrollbar to scroll all the way to the right. (So I guess I'd have to create a canvas, pack all my widgets to the frame, pack the frame to the canvas, configure the canvas with the scrollbar?) I'm not sure if there's a function to set the current position of the scrollbar (thus xview of the window), but I'd imagine there is. Have yet to implement this, but it looks promising. Thanks for the suggestions!
0
1,136
0
0
2011-07-29T07:51:00.000
python,resize,tkinter,tk
Resize Tkinter Window FROM THE RIGHT (python)
0
2
3
6,954,676
1
0
0
I have a USB camera (uEye) which has a C++ interface allowing you to configure some features of the camera. The C++ program can read the image data from the camera and store it somewhere in pre-allocated memory. All of this runs under Windows. Python with numpy gives me a simple environment to manipulate images and spend some quality time working on my processing algorithms. What I would like to do is: Use the c++ program to configure the camera and obtain images (at video rate), Pass the data to Python Process the data in Python I am under the impression that I do not want to embed C++ in Python or Python in C++, as I prefer to have two stand-alone systems (so I can use the camera without the Python stuff, or use the Python stuff without the camera). What I can find so far are methods to share some data using pipes, sockets, or mapped memory, though it appears to be restricted to small amounts of data or strings. What I can not find, however, is an indication if this is fast enough and something that I should attempt to implement. Should I want to do this? If this is a bad idea, what would be a better alternative? Embed the Python code in C++ or vice versa? Or ditch Python all together because the savings in development time there do not offset the additional effort in getting the interprocess communication to work?
false
6,871,537
0.197375
1
0
2
Since you say the device has a "C++ interface", I assume it provides a header file + DLL which you can link to and control the device via an API. In such a case, the fastest approach would be to wrap this API in Python (using Swig or other C++-to-Python API tools). This will provide a very low overhead of just a couple of procedure calls, passing the data directly as pointers to memory. If you don't want to "marry" Python, write yourself a controlling app in C++ too, but I think the fastest and most convenient way of connecting the API to Python is the above.
0
1,214
0
1
2011-07-29T10:08:00.000
c++,python,windows,ipc
Share video data between C++ and Python
0
1
2
6,872,320
1
0
0
I'd like my wxPython application to support cut/copy/paste operations between different running instances of the application. Is it OK to simply pickle a data structure, copy it to clipboard as text, and then unpickle it for paste operations? I know I'd have to check the data for some sign that it's from my app. Or could I just TRY to unpickle whatever is there? How robust is pickle at nicely failing if it tries to unpickle arbitrary text left on the clipboard? Also, is there a practical limit to how much data could be copied this way? I'm running on Windows and Linux today - have not tried Mac. EDIT I'm aware of that comment in the documentation. I don't really care about a malicious user trying to compromise his own instance of the software, if that's what people are worried about they should deprecate pickle. My questions are of practicality, not security.
false
6,877,326
0.099668
0
0
1
You should not trust data from the clipboard for unpickling, unless you have a sure way to make sure it was wrtten by your app, and has not been altered. From the python documentation: Warning The pickle module is not intended to be secure against erroneous or maliciously constructed data. Never unpickle data received from an untrusted or unauthenticated source.
0
261
0
2
2011-07-29T18:18:00.000
python,wxpython,clipboard,pickle
Is it OK to pass complex data structures through the clipboard with wxPython?
0
2
2
6,878,114
1