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
A wxPython program that I'm writing uses two sliders as part of the GUI. These sliders represent a three state switch with the states "On Full", "On Medium" and "Off". I'd like to be able to assign these labels to the ticks on the slider. Is there a way of doing this without having to subclass or position separate static text controls? Thanks, Spry
false
3,715,317
0.197375
0
0
1
Not built in. You'd have to create your own.
0
326
0
0
2010-09-15T06:53:00.000
python,user-interface,wxpython
wxPython: Assigning text labels to ticks on a slider
0
1
1
3,716,150
1
0
0
I wrote a implementation of conway's game of life. I set up two modes, one is auto and the other is manual, which I mean the way to ouput the result of the game. For the auto mode, I cannot stop the running progran without ctrl + q or ctrl + c (which prints out the error message). So is there any way which can allow me to stop the running program and return to the python >>> prompt by pressing some key defined by myself, say, ctrl + k. Thank you.
false
3,737,922
0.066568
0
0
1
Are you running it from an iteractive prompt and want to just get back to the prompt. Or, are you running it from a shell and want to get to a python prompt in but with the current state of the programs execution? For the later it you could the keyboard interupt exception in your code and break out to the python debugger (pdb). import pdb try: mainProgramLoop() except (KeyboardInterrupt, SystemExit): pdb.set_trace()
0
3,663
0
4
2010-09-17T18:23:00.000
python
How to quit the running python program to python prompt?
0
1
3
3,737,996
1
0
0
Is there a way to detect when a window that doesn't belong to my application is being dragged in windows using python/pywin32? I want to set it up so that when I drag a window whose title matches a pattern near the desktop edge, it snaps to the edge when the mouse is let go. I could write code to snap all windows with that title to the desktop whenever the mouse is released, but I want to only move the particular window that was being dragged.
false
3,753,612
0.197375
0
0
2
So far the only possible solution I see is to use SetWindowsHookEx. Pywin32 doesn't interface this, so I think I'll have to do something like this: Write a C extension module. It has a function like setCallback which takes a python function to be called when the drag event happens. Write a C DLL that contains the actual hook into windows. This DLL will somehow have to call the python function that is currently set. I'm not sure how to do these, or if it's correct, though..
0
1,517
0
2
2010-09-20T16:50:00.000
python,winapi,pywin32,windows
python+win32: detect window drag
0
1
2
3,762,323
1
0
0
I have wxpython application that run over a list of files on some directory and proccess the files line by line I need to build a progress bar that show the status how records already done with wx.gauge control I need to count the number of the records before i use the wx.guage in order to build the progress bar , is this the way to do this and if yes what is the best method to count the number of lines of all the files on some directory with pyhon ?
true
3,758,468
1.2
0
0
1
I think you could do 2 progress bars, one for files, and second for line in just read file. This will be similar to copy progress in TotalCommander. If you want one progress bar you could just count file sizes using os.path.getsize(path) and then show how many bytes have you processed/bytes total.
0
222
0
0
2010-09-21T08:20:00.000
python,wxpython
counting records of files on directory with python
0
1
1
3,758,497
1
0
0
I've been looking for how to do this and I've found places where the subject comes up, but none of the suggestions actually work for me, even though they seem to work out okay for the questioner (they don't even list what to import). I ran across self.setWindowFlags(Qt.FramelessWindowHint) but it doesn't seem to work regardless of the import I try (QtGui.FramelessWindowHint, QtCore.FramelessWindowHint, etc.). Any ideas?
true
3,758,648
1.2
0
0
13
u need to import QtCore so the code will look like this : self.setWindowFlags(QtCore.Qt.FramelessWindowHint) whenever you see Qt.something put in mind that they are talking about the Qt class inside QtCore module . hope this helps
0
6,028
0
7
2010-09-21T08:48:00.000
python,pyqt,pyside
Setting window style in PyQT/PySide?
0
1
1
3,761,216
1
0
0
I am interested in programming for Mobile Devices. Now I have a phone which runs Symbian S60 3rd, which is one of my motivations for programming for mobile devices. Now, my question is, which one is better to go for? Python or C++? I have a good background in C++ (ANSI), Java and C#. Thanks.
false
3,763,766
0.039979
1
0
1
Python is more easy to use, but you have to know that a mobile is normally a very strict environment, so is possible that C++ be a better alternative.
0
1,838
0
0
2010-09-21T19:31:00.000
c++,python,symbian
Python or C++? Programming for mobile devices
0
2
5
3,763,786
1
0
0
I am interested in programming for Mobile Devices. Now I have a phone which runs Symbian S60 3rd, which is one of my motivations for programming for mobile devices. Now, my question is, which one is better to go for? Python or C++? I have a good background in C++ (ANSI), Java and C#. Thanks.
true
3,763,766
1.2
1
0
2
There's a large learning curve associated with Symbian C++, if you want to do a quick prototype probably do it in Python. It depends on what you want your application to do. I believe the Symbian Python implementation was done in some Symbian developers spare time so it may not give you access to everything on the phone. Symbian C++ will give you access to almost everything. Also, Java and MIDP may be useful to you too.
0
1,838
0
0
2010-09-21T19:31:00.000
c++,python,symbian
Python or C++? Programming for mobile devices
0
2
5
3,763,991
1
0
0
It's my understanding that in wxPython in OSX, ⌘+w support for closing wx.Window objects. In order to add it, I've had to bind to wx.EVT_KEY_DOWN, checking for event.MetaDown() and event.KeyCode == 'W' explicitly. In my app, I need to have all windows and dialogs support this. I'm still in the process of layout out my GUI, but I got to thinking, and I'm wondering what the best way to add this support to an existing class easily is. I tried out Multiple Inheritance, but it didn't seem to be working (my event handler never got called). I was thinking maybe a class decorator, but this is functionality that will be added at runtime, due to the dynamic nature of python. So I'm a little stumped. PS: I know 'best' is subjective, but I'm honestly looking for anything here that might work that's not an exorbitant amount of code.
true
3,765,496
1.2
0
0
0
I was thinking maybe a class decorator, but this is functionality that will be added at runtime, due to the dynamic nature of python. I don't understand why this makes you "a little stumped". The class decorator executes just after the end of the class statement -- yes, that's "at runtime", but, so is the clqss statement itself, all the def statement in it for its methods, and so forth. By the time you instantiate any of the classes thus decorated, the decorator will have run and so the class you're instantiating will have been modified accordingly by the decorator's code. Can you please give a small example of why this isn't working for you?
0
93
0
0
2010-09-22T00:37:00.000
python,macos,user-interface,wxpython
Command+W Support in wxPython
0
1
1
3,765,854
1
0
0
I have an image having dimension 1000*500 I want to make it of 400*300 But My image should not looked distorted. http://www.daniweb.com/forums/thread295652.html - i used this as a reference. But My image get distorted.
false
3,778,043
0.761594
0
0
5
Your target image size has a different aspect ratio to that of the original. The original is 2:1 but the target is 4:3. You can resize preserving the aspect ratio, but depending on which dimension you choose you'll either get an image that's 400 x 200 or 600 x 300. If you need the image to be 400 x 300 then you'll need to resize to 400 x 200 and then add border to each side or 600 x 300 and add the border to the top and bottom.
0
1,120
0
0
2010-09-23T11:52:00.000
python,image-processing
i want a to resize an image but without distortion
0
1
1
3,778,086
1
0
0
I have a wx.toolbar with some buttons. One of the buttons makes pan left! I want to click on the button and while I keep it pressed, the pan left is made. For now I only saw that the wx.EVT_TOOL only works when mouse left is up. Is there a way to do what I intend ?
true
3,793,526
1.2
0
0
1
In the toolbar button's event, you should be able to get the state of the mouse via wx.GetMouseState. Alternatively, you can make your own toolbar with a panel and some wx.Buttons (or other button widgets).
0
318
0
0
2010-09-25T11:01:00.000
python,events,wxpython,mouseevent
How to change my wx.toolbar event?
0
1
1
3,806,500
1
0
0
IronPython.net documentation says the MSIL in the assembly isn't CLS-compliant, but is there a workaround?
false
3,795,914
0
1
0
0
I'm typing this on my phone so please forgive any silly mistakes. To use the compiled assembly, make sure you compile with clr.CompileModules, NOT pyc.py. Then in your C# call the LoadAssembly method on your Python ScriptEngine object. The module can then be imported by calling the ImportModule method on your ScriptEngine. From there if you can take advantage of the dynamic keyword, do so. Otherwise you'll be stuck with some magic string heavy calls to GetVariable. Also note that you'll have to provide the standard library to your compiled Python Assembly in one form or another.
1
305
0
1
2010-09-25T23:07:00.000
c#,ironpython,.net-assembly,cil,cls-compliant
Is there a way to use IronPython objects and functions (compiled into an assembly) from C# code?
0
1
2
3,835,553
1
0
0
I have used Lua.NET on .NET platform and I could call the .NET class/object from Lua and I could call the Lua from .NET Lua API interface. I did the same with the IronPython. I knew the how the .NET binding works. Now I have a C++ project and I want to use the dynamic capabilities. I want to call C++ object which may not be possible from Lua so I may need to call some C API which makes call to C++. Meantime I want to call the Lua from C++. We have configuration data which is best described in table like format in Lua or List & Dict like in Python. We need to enumerate these data structures defined in Lua/Python in C++. When considering Lua to Python in C++ for two way calling, is Python have upper hand with Boost Python library? I don't have experience in Python/C++ binding. I don't have equal experience of using Python in C++ and calling Python from C++.
false
3,818,703
0
1
0
0
If you are planning to just use windows you could use C++/CLI a managed variant of C++. With C++/CLI you can easily mix managed and unmanaged code. You could call the managed classes from any .net language and the unmanaged (exported) functions from C.
0
3,491
0
2
2010-09-29T04:22:00.000
c++,python,boost,lua,embedding
Lua or Python binding with C++
0
1
2
3,819,333
1
0
0
all, I want to draw a rectangular or a container with 20 slots inside. it is like a cd container or archive, with empty slot to insert the cd or book. I choose wxPython. for this 20 horizontal empty slots, i see there is wx.BoxSizer(wx.Horizonal) or other sizers to make the layout. my question is, Is it possible to have "visible border and grey background" (to represent the empty slots) for the spaces generated by the wx.BoxSizer? It seems to me that, it is not possible. The sizer seems only to do layout, instead of generating visible subwindow. If it is not possible, I think I need to create a slot window class for this "border and colorful background" feature, and create 20 slot window objects and add into the sizer. Then, I have to use create another window class to represent the book or CD, and insert this CD window to the slot window. This sounds a bit awkard. I do not know if slot window is necessary or maybe wx.sizer (or other sizer) could achieve the same effect as the slot window.
true
3,823,429
1.2
0
0
1
I would create a subclass of wx.Panel for each "slot", then manage them with a grid or box sizer.
0
355
0
0
2010-09-29T15:58:00.000
wxpython,window,sizer
use wxPython to draw a grided rectangular container or box
0
1
1
3,823,479
1
0
0
I have a Toplevel widget I'd like it so that it would never appear within the confines of the main Tk window. Basically so that when the Toplevel appears it doesn't cover up any of the main Tk window.
true
3,836,086
1.2
0
0
1
You want to use wm_geometry and a tiny bit of math to calculate and set a suitable starting position for the second toplevel.
0
348
0
1
2010-10-01T02:10:00.000
python,tkinter
Toplevel widgets in Tkinter
0
1
2
3,836,182
1
0
0
I'm developing a plugin UI for an existing application using PyQt4. The window is created using uic.loadUi() on the press of a button in the main window. The problem is that if I press the button again (while the window is showing) the window is re-created and unsaved changes are lost. I don't want to make the window modal. Which options do I have to cope with this problem? I guess it would be related to checking whether the QWidget is already showing.
true
3,839,426
1.2
0
0
2
You should initializer a pointer to the QWidget (member variable) to 0. When the button is pressed, check if the pointer is 0 - if it is, load and show the widget, and assign the pointer variable to point to the new widget. If the pointer is not null when the button is pressed, call widget->raise() and widget->activateWindow(). Disabled buttons can be frustrating to users, as can buttons which appear to do nothing because e.g. their effect is hidden.
0
1,072
0
2
2010-10-01T13:07:00.000
python,user-interface,qt4,pyqt4
How to check if a QWidget is already showing?
0
2
2
3,839,514
1
0
0
I'm developing a plugin UI for an existing application using PyQt4. The window is created using uic.loadUi() on the press of a button in the main window. The problem is that if I press the button again (while the window is showing) the window is re-created and unsaved changes are lost. I don't want to make the window modal. Which options do I have to cope with this problem? I guess it would be related to checking whether the QWidget is already showing.
false
3,839,426
0
0
0
0
I would have thought that this would be handled more by your application logic than anything else. The main window should disable the button after it has been clicked and then re-enable it again when the window is closed. Connect up a closing signal on the secondary window to a slot on the main window to notify the main window when the secondary window is being closed.
0
1,072
0
2
2010-10-01T13:07:00.000
python,user-interface,qt4,pyqt4
How to check if a QWidget is already showing?
0
2
2
3,839,466
1
0
0
It doesn't look like it has that attribute, but it'd be really useful to me.
false
3,842,155
0
0
0
0
You could use a Label instead. A Label can be edited programmatically and cannot be edited by the user.
0
131,968
0
83
2010-10-01T18:47:00.000
python,text,tkinter
Is there a way to make the Tkinter text widget read only?
0
1
13
58,942,250
1
0
0
I am developing an application that uses multiple threads to gather data from a variety of network devices. I'm using PyQT to display the collected data on a GUI. I am using regular python threads (from thread, threading) in my app (instead of QThread). In order to update the GUI on the different threads, I use a lock (thread.allocate_lock()). So, anytime a GUI update will happen, I call with lock, update GUI. Any concerns about this?
false
3,842,558
-0.066568
0
0
-1
I use pyqtSignal and Python's threading. You can create threads and when the thread is completed have it send a signal to update your GUI.
1
7,384
0
1
2010-10-01T19:50:00.000
python,multithreading,pyqt
PyQT and threads
0
1
3
3,886,587
1
0
1
I have input values of x, y, z coordinates in the following format: [-11.235865 5.866001 -4.604924] [-11.262565 5.414276 -4.842384] [-11.291885 5.418229 -4.849229] [-11.235865 5.866001 -4.604924] I want to draw polygons and succeeded with making a list of wx.point objects. But I need to plot floating point coordinates so I had to change it to point2D objects but DrawPolygon doesn't seem to understand floating points, which returns error message: TypeError: Expected a sequence of length-2 sequences or wxPoints. I can't find anywhere in the API that can draw shapes based on point2D coordinates, could anyone tell me a function name will do the job? Thanks
false
3,852,146
0
0
0
0
DC's only use integers. Try using Cairo or wx.GraphicsContext.
0
1,320
0
1
2010-10-04T00:29:00.000
python,wxpython
How to draw polygons with Point2D in wxPython?
0
1
3
3,855,400
1
0
0
If I write a python script, anyone can simply point an editor to it and read it. But for programming written in C, one would have to use decompilers and hex tables and such. Why is that? I mean I simply can't open up the Safari web browser and look at its code.
false
3,869,435
0
1
0
0
Python scripts are analogous to a man looking at a to-do list written in English (or language he understands). The man has to do all the work, every time that list of things has to be done. If the man, instead of doing the steps on his own each time, creates and programs a robot which can carry out those steps again and again (and probably faster than him), that robot is analogous to the C program. The man in the python case is called the "interpreter" and in the C case is called the "compiler", and the C robot is called the compiled program/executable. When you look at the python program source, you see the to-do list. In case of the robot, you see the gears, motors and batteries, etc, which look very different from the to-do list. If you could get hold of the C "to-do" list, it looks somewhat like the python code, just in a different language.
1
801
0
3
2010-10-06T04:07:00.000
python,c,decompiling
Why do C programs require decompilers but python programs dont?
0
7
11
3,869,481
1
0
0
If I write a python script, anyone can simply point an editor to it and read it. But for programming written in C, one would have to use decompilers and hex tables and such. Why is that? I mean I simply can't open up the Safari web browser and look at its code.
false
3,869,435
0.090659
1
0
5
This is sorta a big topic. You should look into your local friendly Computer Science curriculum, you'll find a lot of great stuff on this subject there. The short answer is the Python is an "interpreted" language, which means that it requires a machine language program (the python interpreter) to run the python program, adding a layer of indirection. C or C++ are different. They are compiled directly to machine code, which runs directly on your processor. There is a lot of additional voodoo to be learned here, however. Technically Python is compiled to a bytecode, and modern interpreters do more and more "Just in Time" compilation, so the boundaries between compiled and interpreted code are getting fuzzier all the time.
1
801
0
3
2010-10-06T04:07:00.000
python,c,decompiling
Why do C programs require decompilers but python programs dont?
0
7
11
3,869,458
1
0
0
If I write a python script, anyone can simply point an editor to it and read it. But for programming written in C, one would have to use decompilers and hex tables and such. Why is that? I mean I simply can't open up the Safari web browser and look at its code.
false
3,869,435
0.01818
1
0
1
because C code is complied to object (machine) code and python code is compiled into an intermediate byte code. I am not sure if you are even referring to the byte code of python - you must be referring to the source file itself which is directly executable (hiding the byte code from you!). C needs to be compiled and linked.
1
801
0
3
2010-10-06T04:07:00.000
python,c,decompiling
Why do C programs require decompilers but python programs dont?
0
7
11
3,869,445
1
0
0
If I write a python script, anyone can simply point an editor to it and read it. But for programming written in C, one would have to use decompilers and hex tables and such. Why is that? I mean I simply can't open up the Safari web browser and look at its code.
false
3,869,435
0
1
0
0
Python scripts are parsed and converted to binary only when they're run - i.e., they're text files and you can read them with an editor. C code is compiled and linked to an executable binary file before they can be run. Normally, only this executable binary file is distributed - hence you need a decompiler. You can always view the source code, if you've access to it.
1
801
0
3
2010-10-06T04:07:00.000
python,c,decompiling
Why do C programs require decompilers but python programs dont?
0
7
11
3,869,451
1
0
0
If I write a python script, anyone can simply point an editor to it and read it. But for programming written in C, one would have to use decompilers and hex tables and such. Why is that? I mean I simply can't open up the Safari web browser and look at its code.
false
3,869,435
0
1
0
0
G-WAN executes ANSI C scripts on the fly -making it just like Python scripts. This can be server-side scripts (using G-WAN as a Web server) or any general-purpose C program and you can link any existing library. Oh, and G-WAN C scripts are much faster than Python, PHP or Java...
1
801
0
3
2010-10-06T04:07:00.000
python,c,decompiling
Why do C programs require decompilers but python programs dont?
0
7
11
3,874,099
1
0
0
If I write a python script, anyone can simply point an editor to it and read it. But for programming written in C, one would have to use decompilers and hex tables and such. Why is that? I mean I simply can't open up the Safari web browser and look at its code.
false
3,869,435
1
1
0
10
Python is a script language, runs in a virtual machine through an interpeter. C is a compiled language, the code compiled to binary code which the computer can run without all that extra stuff Python needs.
1
801
0
3
2010-10-06T04:07:00.000
python,c,decompiling
Why do C programs require decompilers but python programs dont?
0
7
11
3,869,443
1
0
0
If I write a python script, anyone can simply point an editor to it and read it. But for programming written in C, one would have to use decompilers and hex tables and such. Why is that? I mean I simply can't open up the Safari web browser and look at its code.
false
3,869,435
0.036348
1
0
2
Yes, you can - it's called disassembling, and allows you to look at the code of Safari perfectly well. The thing is, C, among other languages, compiles to native code, i.e. code that your CPU can "understand" and execute. More or less obviously, the level of abstraction present in the instruction set of your CPU is much smaller than that of a high level language like Python. The CPU instructions are not concerned with "downloading that URI", but more "check if that bit is set in a hardware register". So, in conclusion, the level of complexity present in a native application is much higher when looking at the machine code, so many people simply can't make any sense of what is going on there, it's hard to get the big picture. With experience and time at your hands, it is possible though - people do it all the time, reversing applications and all.
1
801
0
3
2010-10-06T04:07:00.000
python,c,decompiling
Why do C programs require decompilers but python programs dont?
0
7
11
3,869,460
1
1
0
I have a QWebView in my app which renders a html page stored in the app as a Qresource. This page, however requires meaty external Javascript libraries such as MathJax, which I would want to include as a resource due to its size. My problem is that it seems that QtWebkit does not cache these files as a regular browser would do, and every time I refresh the widget it downloads MathJax afresh. So my question is: is there any way to cache these libraries after first time they are downloaded, without having resorting to shipping it with the app as resource?
false
3,872,033
0
0
0
0
Could you post some source code? Once downloaded that data will stay in the /tmp/ folder for some time. You could likely use the data in the temp folder, my guess is you are not enforcing that policy.
0
1,071
0
1
2010-10-06T11:41:00.000
javascript,python,pyqt,qtwebkit
Caching external javascript for a QtWebkit widget in a PyQt app
0
1
2
3,886,529
1
0
0
Is anybody familiar with Worldviz-Vizard's 3D engine for python? How does it compare to Panda3D? I have a feeling that it might be easier to learn but far more limited. They only support python 2.4 which also makes me not want to try it.
false
3,877,971
0.132549
1
0
2
Been using Vizard for various VR and AR development for about 3 yrs now - it's NOT unity - i.e. a web enabled game engine (excellent though it is) - what Vizard provides is a highly optimized OpenGL engine, wrapped in user friendly python scripting environment BUT on top of this you get the ability to seamlessly distribute your simulations over a cluster or a network. Vizard keeps all things completely synched - invisible to the user. Connects to pretty much all known VR tracking equipment and display periphals and standard gaming equipment is also supported (Wiimote & Kinnect). Native support for frame sequential, side-by-side and anaglyph stereo, spatial sound engine and the ability to extend it with C and C++ plugins or GLSL shaders. Didn't actually mean to write that much and I don't want to come across as a Vizard evangelist, it is not perfect, BUT comparing it to Panda3D, Unity or other game engines I feel is an unfair comparison - not like-for-like :o)
0
1,459
0
1
2010-10-07T00:54:00.000
python,pygame,3d-engine,panda3d
How does Worldviz Vizard compares to Panda3D and Pygame?
0
2
3
6,589,557
1
0
0
Is anybody familiar with Worldviz-Vizard's 3D engine for python? How does it compare to Panda3D? I have a feeling that it might be easier to learn but far more limited. They only support python 2.4 which also makes me not want to try it.
false
3,877,971
0
1
0
0
I only used Vizard, and that for one small project. It was easy to use, well documented, and had a good set of examples.
0
1,459
0
1
2010-10-07T00:54:00.000
python,pygame,3d-engine,panda3d
How does Worldviz Vizard compares to Panda3D and Pygame?
0
2
3
4,122,231
1
0
0
How do I generate a list of lines to draw if I have pixel data for an image, so I don't have to draw every pixel? Any language will do, although I listed what I have a working knowledge for. C is ok as well. There was a limit to how many tags I could choose. Also, you can just point me toward an algorithm.
false
3,878,873
0
0
0
0
Opencv has functions named like "cvHoughLines2" to detect lines.
0
515
0
0
2010-10-07T05:13:00.000
c#,c++,python,image,lua
transforming an image into an array of lines to draw
0
4
5
3,895,535
1
0
0
How do I generate a list of lines to draw if I have pixel data for an image, so I don't have to draw every pixel? Any language will do, although I listed what I have a working knowledge for. C is ok as well. There was a limit to how many tags I could choose. Also, you can just point me toward an algorithm.
true
3,878,873
1.2
0
0
1
You are looking for a "raster to vector" algorithm. The term comes from early graphics display systems, that used a CRT (cathode ray tube) for the display itself. There were 2 approaches to displaying graphics: "raster" was the scan of a series of lines left to right, top to bottom, each line made up of on/off pixels. The controller of the CRT's electron gun simply scanned the same pattern over and over, just varying the intensity of the electron beam. On a "vector" display, the electron gun could draw a straight line between any two points - no aliasing, no pixelation, just a pure straight line. Vector displays were capable of higher resolution, but were limited by the number of lines they could draw - if a drawing had too many lines, then the display would begin to flicker as the time it would take to redraw the picture (to refresh the phosphors of the CRT) would take longer than the persistence of the CRT's phosphor surface. Raster displays were simpler to control, had much less flicker, but lower resolution.
0
515
0
0
2010-10-07T05:13:00.000
c#,c++,python,image,lua
transforming an image into an array of lines to draw
0
4
5
3,880,279
1
0
0
How do I generate a list of lines to draw if I have pixel data for an image, so I don't have to draw every pixel? Any language will do, although I listed what I have a working knowledge for. C is ok as well. There was a limit to how many tags I could choose. Also, you can just point me toward an algorithm.
false
3,878,873
0.039979
0
0
1
In general, bitmaps are stored in sequential memory, ideal for 'blitting' to the display; your GUI framework of choice will have a function for drawing bitmaps, and this function will be very carefully optimised. On the other hand, decomposing an image into lines - vectorizing the image - is the domain of specialist programs and ongoing research. In all cases, its going to be slower to computer and slower to draw than just blitting the bitmap.
0
515
0
0
2010-10-07T05:13:00.000
c#,c++,python,image,lua
transforming an image into an array of lines to draw
0
4
5
3,879,121
1
0
0
How do I generate a list of lines to draw if I have pixel data for an image, so I don't have to draw every pixel? Any language will do, although I listed what I have a working knowledge for. C is ok as well. There was a limit to how many tags I could choose. Also, you can just point me toward an algorithm.
false
3,878,873
0
0
0
0
How can you achieve with lines what you have to do with pixels? You need to draw each pixel individually I'd say.
0
515
0
0
2010-10-07T05:13:00.000
c#,c++,python,image,lua
transforming an image into an array of lines to draw
0
4
5
3,879,102
1
0
0
Due to refactoring/reworking on a controller I've had to embed a Python Interpreter inside a C application. I can now call python functions and pass/get Objects into Python fine. The python code is a controller for a robot (currently simulated), this now needs make use of some C code for comparisons I'm making. Previously the Python code created objects, read sensors, ran control code and wrote the outputs to motors. All of this except the control code now needs to be done in C. The problem I have is that Objects which are created in an init function (in python) which, when I come to run the control code no longer exist. What is the best way to solve this? My idea was to return the controllers from the init function and store references to them in the C, passing the reference to the controller each time it is called. Thanks for any help.
false
3,883,724
0.197375
1
0
1
This may not be the answer you want, but there are ways of working with C and Python other than embedding an interpreter inside a C application. Namely, why don't you do the opposite? Create C libraries for Python? You can control the general flow of your application in Python, which is much more comfortable, and call C code whenever you see fit. Again, I'm not really addressing your actual question, so feel free to ignore me.
0
102
0
0
2010-10-07T16:26:00.000
python,c,embedded-language
Maintaining a Python Object when embedding in C
0
1
1
3,884,055
1
0
0
I have a programs that runs several threads (on a while loop until Ctrl C is pressed). The app also has a GUI that I developed in PyQt. However, I am facing the following problem: If I press Ctrl C on the console, and then close the GUI, the program exits fine. However, if I close the GUI first, the other threads won't stop and the program keeps running after Ctrl C. Anyone knows how I could address this problem?
false
3,886,500
0
0
0
0
In Qt you would overload the OnClose method for the widget/frame or hook the lastwindowsdclosed signal to do whatever you need to shut down the app - don't know if it's diiferent from python
0
722
0
0
2010-10-07T22:56:00.000
python,multithreading,pyqt,copy-paste
PyQT4 and Ctrl C
0
1
1
3,886,510
1
0
0
I am looking for qrcode generator for python window version. Can anyone help me to find out. I didn't get anywhere. Please help me. Thanks, manu
false
3,888,125
0
0
0
0
pyqrnative is working pretty well for me. I wish I could find some documentation in English for it. Would like to know the relationship between data content size and the first "typeNumber" argument.
0
8,188
0
5
2010-10-08T06:17:00.000
python,qr-code
qrcode generator using python for windows
0
1
5
5,047,781
1
0
0
I need a simple interpreter which will do execution (evaluation) of simple expressions/statements and also call functions from main C++ applications. At the moment I do not need scripting of the application, but it may be useful later. It should also be strait-forward for other team members to pull my application from Source Repository and to build it, without having to install additional application, libraries, etc. Searching reveled options like: Python (via Boost and / or Python API), Lua, Guile, TinyScheme. I am the closest to Python, but using Boost, building Python library, complicated task of interfacing main application with Python makes this choice an overkill, maybe I am wrong. There should be a simple solution for this request, what are your experiences and suggestions?
false
3,896,313
0.049958
0
0
1
Guile is easy to embed and extend, and scheme if powerfull programming language. You can compile libguile and add it to the repository in lib directory or add source for guile and compile it when user compile the project. But I don't try to use guile on Windows.
0
739
1
3
2010-10-09T16:04:00.000
c++,python,scripting,lua
Simple interpreter to embed and extend inside an C++ Windows application
0
3
4
3,897,041
1
0
0
I need a simple interpreter which will do execution (evaluation) of simple expressions/statements and also call functions from main C++ applications. At the moment I do not need scripting of the application, but it may be useful later. It should also be strait-forward for other team members to pull my application from Source Repository and to build it, without having to install additional application, libraries, etc. Searching reveled options like: Python (via Boost and / or Python API), Lua, Guile, TinyScheme. I am the closest to Python, but using Boost, building Python library, complicated task of interfacing main application with Python makes this choice an overkill, maybe I am wrong. There should be a simple solution for this request, what are your experiences and suggestions?
true
3,896,313
1.2
0
0
4
Two great options you've already listed are Python and Lua. Here are some of the tradeoffs for your consideration: Python A much more complete and powerful language (IMHO!) with libraries for anything and tons of support and communities everywhere you look. Syntax is not entirely C-like Although Python wasn't designed specifically for embedding (it's much more often used as a standalone language extended by code in C/C++), it's tot really hard to embed. The official docs contain some examples, and following Boost's examples shouldn't be much harder. Lua Designed from bottom up for embedding, so it should be the simplest one to embed. Syntax more C-like than Python's If you foresee a definite future need for scripting, building in a scripting engine early is a good idea as it may open some interesting possibilities for you as you go on developing the program. Both options listed above are good ones, you should have no problems embedding any of them without much effort.
0
739
1
3
2010-10-09T16:04:00.000
c++,python,scripting,lua
Simple interpreter to embed and extend inside an C++ Windows application
0
3
4
3,897,270
1
0
0
I need a simple interpreter which will do execution (evaluation) of simple expressions/statements and also call functions from main C++ applications. At the moment I do not need scripting of the application, but it may be useful later. It should also be strait-forward for other team members to pull my application from Source Repository and to build it, without having to install additional application, libraries, etc. Searching reveled options like: Python (via Boost and / or Python API), Lua, Guile, TinyScheme. I am the closest to Python, but using Boost, building Python library, complicated task of interfacing main application with Python makes this choice an overkill, maybe I am wrong. There should be a simple solution for this request, what are your experiences and suggestions?
false
3,896,313
0.099668
0
0
2
No matter which scripting language you choose (and I would probably vote for Python), you might consider using SWIG (www.swig.org) to ease the burden of interfacing to C++. While normally used to build C++ extensions for python (or ruby, lua, guile, any many others), it can be used to aid in embedding too. You had mentioned boost::python, which is certainly a full featured option, and allows for a somewhat closer Python/C++ integration (especially where virtual functions are involved). However, in my experience, SWIG is a lot easier to integrate, works with scads of scripting languages, and for python, is natively supported by Python's distutils.
0
739
1
3
2010-10-09T16:04:00.000
c++,python,scripting,lua
Simple interpreter to embed and extend inside an C++ Windows application
0
3
4
3,898,118
1
0
0
I'm writing a small app which has 2 separate frames. The first frame is like a video player controller. It has Play/Stop/Pause buttons etc. It's named controller.py. The second frame contains OpenGL rendering and many things inside it, but everything is wrapped inside a Frame() class as the above. It's named model.py. I'm up to the final part where I have to "join" these two together. Does anyone know how to control a frame (model.py) from another frame (controller.py)? I would like to do something like a movie player when you clicks play it pops up a new window and play until the stop button is clicked. If you know how, please let me know. (Just tell me in general no need to specific).
false
3,898,988
0.099668
0
0
1
I'd definitely use PubSub as it's probably the cleanest way I can think of to do it. You can also do it with wx.PostEvent or use a modal frame.
0
669
0
1
2010-10-10T04:11:00.000
python,wxpython,frame,send
How to control a frame from another frame?
0
1
2
3,906,746
1
0
0
I am hoping to use PyQt to produce an application that will display an equation entered by the user. I had considered matplotlib, but this seems like overkill as I would only be using it to render the latex. I need to use SymPy anyway, so I was hoping there would be a way to use it to do the rendering also, preferably producing an SVG file for PyQt to use. I hope this makes sense - many thanks in advance for any help/advice. Best wishes, Geddes
false
3,902,008
0.462117
0
0
5
If you just need simple rendering using python, how about trying ipython 0.11 with qtconsole using sympy profile(ipython qtconsole --profile=sympy). It did implement matplotlib, but I consider it quite clean considering mathematical expressions can be rendered directly on the qtconsole. Need to install pyzmq module.
0
2,067
0
5
2010-10-10T20:17:00.000
python,latex,pyqt,sympy
Is it possible for SymPy to render LaTeX for use in a GUI?
0
1
2
6,916,267
1
1
0
I'm developing a simple Python program with a (dynamic) form interface, but it needs to run on Google App Engine. I understand that IronPython lets one use Visual Studio's drag-and-drop interface builder and classes while programming with Python, but will this be compatible with Google App Engine?
false
3,908,062
0.53705
0
0
3
Google's Google App Engine can only run pure python code, and not even all Python is supported. No, you can't do things like IronPython. If you want to use Python, I'd learn Django. If you want something closer to .NET, I'd go with Java.
0
651
0
3
2010-10-11T16:23:00.000
python,user-interface,google-app-engine,ironpython
Can I use IronPython to develop GUIs for Google App Engine?
0
1
1
3,908,074
1
0
0
I have a pygtk application and would like to provide a text-based fallback mode for it. When mporting gtk without a X display available I see only a GtkWarning on stderr but no exception I could take advantage of and checking for DISPLAY seems like an ugly hack. How can I implement this?
true
3,914,370
1.2
0
0
0
Checking gtk.gdk.screen_get_default() does it, however there seems no way to suppress the GTK warnings.
0
46
0
1
2010-10-12T11:56:00.000
python,pygtk
Implementing a text-based fallback for pygtk applications
0
1
1
3,917,071
1
0
0
I have a problem with my python application, and I think it's related to the python garbage collection, even if I'm not sure... The problem is that my application takes a lot of time to exit and to switch to one function to the next one. In my application I handle very large dictionaries, containing thousands of large objects which are instantiated from wrapped C++ classes. I put some timestamp outputs in my program, and I saw that at the end of each function, when objects created inside the function should go out of scope, a lot of time is spent by the interpreter before calling the next function. And I observe the same problem at the end of the application, when the program should exit: a lot of time (~ hours!) is spent between the last timestamp on screen and the appearance of the fresh prompt. The memory usage is stable, so I don't really have memory leaks. Any suggestions? Can be the garbage collection of thousands of large C++ objects that slow? Is there a method to speed up that? UPDATE: Thanks a lot for all your answers, you gave me a lot of hints to debug my code :-) I use Python 2.6.5 on Scientific Linux 5, a customized distribution based on Red Hat Enterprise 5. And actually I'm not using SWIG to get Python bindings for our C++ code, but the Reflex/PyROOT framework. I know, it's not very known outside particle physics (but still open source and freely available) and I have to use it because it's the default for our main framework. And in this context the DEL command from the Python side does not work, I had already tried it. DEL only deletes the python variable linked to the C++ object, not the object itself in memory, which is still owned by the C++ side... ...I know, it's not-standard I guess, and a bit complicated, sorry :-P But following your hints, I'll profile my code and I'll come back to you with more details, as you suggested. ADDITIONAL UPDATE: Ok, following your suggestions, I instrumented my code with cProfile, and I discovered that actually the gc.collect() function is the function taking the most of the running time!! Here the output from cProfile + pstats print_stats(): >>> p.sort_stats("time").print_stats(20) Wed Oct 20 17:46:02 2010 mainProgram.profile 547303 function calls (542629 primitive calls) in 548.060 CPU seconds Ordered by: internal time List reduced from 727 to 20 due to restriction ncalls tottime percall cumtime percall filename:lineno(function) 4 345.701 86.425 345.704 86.426 {gc.collect} 1 167.115 167.115 200.946 200.946 PlotD3PD_v3.2.py:2041(PlotSamplesBranches) 28 12.817 0.458 13.345 0.477 PlotROOTUtils.py:205(SaveItems) 9900 10.425 0.001 10.426 0.001 PlotD3PD_v3.2.py:1973(HistoStyle) 6622 5.188 0.001 5.278 0.001 PlotROOTUtils.py:403(__init__) 57 0.625 0.011 0.625 0.011 {built-in method load} 103 0.625 0.006 0.792 0.008 dbutils.py:41(DeadlockWrap) 14 0.475 0.034 0.475 0.034 {method 'dump' of 'cPickle.Pickler' objects} 6622 0.453 0.000 5.908 0.001 PlotROOTUtils.py:421(CreateCanvas) 26455 0.434 0.000 0.508 0.000 /opt/root/lib/ROOT.py:215(__getattr__) [...] >>> p.sort_stats("cumulative").print_stats(20) Wed Oct 20 17:46:02 2010 mainProgram.profile 547303 function calls (542629 primitive calls) in 548.060 CPU seconds Ordered by: cumulative time List reduced from 727 to 20 due to restriction ncalls tottime percall cumtime percall filename:lineno(function) 1 0.001 0.001 548.068 548.068 PlotD3PD_v3.2.py:2492(main) 4 0.000 0.000 346.756 86.689 /usr/lib//lib/python2.5/site-packages/guppy/heapy/Use.py:171(heap) 4 0.005 0.001 346.752 86.688 /usr/lib//lib/python2.5/site-packages/guppy/heapy/View.py:344(heap) 1 0.002 0.002 346.147 346.147 PlotD3PD_v3.2.py:2537(LogAndFinalize) 4 345.701 86.425 345.704 86.426 {gc.collect} 1 167.115 167.115 200.946 200.946 PlotD3PD_v3.2.py:2041(PlotBranches) 28 12.817 0.458 13.345 0.477 PlotROOTUtils.py:205(SaveItems) 9900 10.425 0.001 10.426 0.001 PlotD3PD_v3.2.py:1973(HistoStyle) 13202 0.336 0.000 6.818 0.001 PlotROOTUtils.py:431(PlottingCanvases) 6622 0.453 0.000 5.908 0.001 /root/svn_co/rbianchi/SoftwareDevelopment [...] >>> So, in both outputs, sorted by "time" and by "cumulative" time respectively, gc.collect() is the function consuming the most of the running time of my program! :-P And this is the output of the memory profiler Heapy, just before returning the main() program. memory usage before return: Partition of a set of 65901 objects. Total size = 4765572 bytes. Index Count % Size % Cumulative % Kind (class / dict of class) 0 25437 39 1452444 30 1452444 30 str 1 6622 10 900592 19 2353036 49 dict of PlotROOTUtils.Canvas 2 109 0 567016 12 2920052 61 dict of module 3 7312 11 280644 6 3200696 67 tuple 4 6622 10 238392 5 3439088 72 0xa4ab74c 5 6622 10 185416 4 3624504 76 PlotROOTUtils.Canvas 6 2024 3 137632 3 3762136 79 types.CodeType 7 263 0 129080 3 3891216 82 dict (no owner) 8 254 0 119024 2 4010240 84 dict of type 9 254 0 109728 2 4119968 86 type Index Count % Size % Cumulative % Kind (class / dict of class) 10 1917 3 107352 2 4264012 88 function 11 3647 5 102116 2 4366128 90 ROOT.MethodProxy 12 148 0 80800 2 4446928 92 dict of class 13 1109 2 39924 1 4486852 93 __builtin__.wrapper_descriptor 14 239 0 23136 0 4509988 93 list 15 87 0 22968 0 4532956 94 dict of guppy.etc.Glue.Interface 16 644 1 20608 0 4553564 94 types.BuiltinFunctionType 17 495 1 19800 0 4573364 94 __builtin__.weakref 18 23 0 11960 0 4585324 95 dict of guppy.etc.Glue.Share 19 367 1 11744 0 4597068 95 __builtin__.method_descriptor Any idea why, or how to optimize the garbage collection? Is there any more detailed check I can do?
false
3,916,553
-1
1
0
-5
If your problem really is the garbage collection, try explicitly freeing your objects when you're done with them using del(). In general, this doesn't sound like a garbage collection problem, unless we're talking about terabytes of memory. I agree with S.Lott... profile your app, then bring code snippets and the results of that back and we can be much more helpful.
0
13,216
0
18
2010-10-12T15:50:00.000
python,garbage-collection,root,performance
Python garbage collection can be that slow?
0
1
3
3,919,321
1
0
0
I am new to the world of PyQt.I am using PyQt designer for designing the UI and coding to provide functionality in it.But unfortunately I am getting confused to link with the UI.By importing the class we generally doing in examples.But when I try my own code its not happening. Any hints for how designer and other parts interacts will be super helpful. Thanks in advance!
false
3,949,842
-0.099668
0
0
-1
winBase, winForm = uic.loadUiType("mainWindow.ui") # this is the file created whith Qt Designer class Window(winBase, winForm): def __init__(self, parent = None) super(winBase, self).__init__(parent) self.setupUi(self)
0
1,463
0
0
2010-10-16T17:01:00.000
python,user-interface,pyqt4
PyQt GUI based CRUD application
0
1
2
11,305,421
1
0
0
I'm using Python and Tkinter, and I need to know the current dimensions (width, height) of a widget. I've tried somewidget["width"], but it returns only a fixed value, and is not updated whenever the widget size changes (e.g. when the window is resized).
true
3,950,687
1.2
0
0
77
Use somewidget.winfo_width() and somewidget.winfo_height() to get the actual widget size, the somewidget['width'] property is only a hint given to the geometry manager.
0
81,835
0
62
2010-10-16T20:39:00.000
python,tkinter
How to find out the current widget size in tkinter?
0
3
3
3,950,766
1
0
0
I'm using Python and Tkinter, and I need to know the current dimensions (width, height) of a widget. I've tried somewidget["width"], but it returns only a fixed value, and is not updated whenever the widget size changes (e.g. when the window is resized).
false
3,950,687
1
0
0
82
somewidget.winfo_width() and somewidget.winfo_height() give 1. You need to update Tk (issue tk.update()) before getting these values.
0
81,835
0
62
2010-10-16T20:39:00.000
python,tkinter
How to find out the current widget size in tkinter?
0
3
3
49,216,638
1
0
0
I'm using Python and Tkinter, and I need to know the current dimensions (width, height) of a widget. I've tried somewidget["width"], but it returns only a fixed value, and is not updated whenever the widget size changes (e.g. when the window is resized).
false
3,950,687
1
0
0
13
You can use the function somewidget.winfo_reqheight() for height and somewidget.winfo_reqwidth() for width, but first don't forget to call the update function of the widget you want to know the dimension somewidget.update(). If you do not call the update function you will get the default value 1.
0
81,835
0
62
2010-10-16T20:39:00.000
python,tkinter
How to find out the current widget size in tkinter?
0
3
3
60,086,946
1
0
0
I have a python dictionary stored in a file which I need to access from a c++ program. What is the best way of doing this? Thanks
false
3,966,227
0.132549
1
0
2
There are umpteen Python/C++ bindings (including the one in Boost) but I suggest KISS: not a Python/C++ binding but the principle "Keep It Simple, Stupid". Use a Python program to access the dictionary. :-) You can access the Python program(s) from C++ by running them, or you can do more fancy things such as communicating between Python and C++ via sockets or e.g. Windows "mailslots" or even some more full-fledged interprocess communication scheme. Cheers & hth.
1
2,650
0
0
2010-10-19T07:47:00.000
c++,python,dictionary
Read python dictionary using c++
0
2
3
3,966,356
1
0
0
I have a python dictionary stored in a file which I need to access from a c++ program. What is the best way of doing this? Thanks
false
3,966,227
0
1
0
0
I assume your Python dict is using simple data types and no objects (so strings/numbers/lists/nested dicts), since you want to use it in C++. I would suggest using json library (http://docs.python.org/library/json.html) to deserialize it and then use a C++ equivalent to serialize it to a C++ object.
1
2,650
0
0
2010-10-19T07:47:00.000
c++,python,dictionary
Read python dictionary using c++
0
2
3
3,967,560
1
0
0
how can I set width to a tk.Frame (post-initialization ?) In other words, is there a member function to do it ? Sometheing like frame.setWidth() thanks
true
3,968,275
1.2
0
0
3
frame.config(width=100) Be aware that if there are children in the frame that are managed by grid or pack, your changes may have no effect. There are solutions to this, but it is rarely needed. Generally speaking you should let widgets be their natural size. If you do need to resize a frame that is a container of other widgets you need to turn "geometry propagation" off.
0
4,026
0
3
2010-10-19T12:26:00.000
python,tkinter
TKinter: how to change Frame width dynamically
0
1
1
3,968,351
1
0
0
In which kind of application is Tkinter usually used? I'm doing a project in Python in which I'm using it for the first time to build a simple user interface. I was wondering if this is widely used for specific applications, or mobile applications.. etc
true
3,970,255
1.2
0
0
4
As far as I have seen, Tkinter is great for simple applications, teaching, or for when you don't need the features of a more comprehensive package like Qt or wxWidgets. These libraries can run several megabytes, and you may not need that. It's part of the standard library, so it's suited for this purpose. However, if you need more features, then Tkinter may not be the best choice. Tkinter also used to look really ugly because it drew its own widgets on each platform; however, I think the version included with Python 2.7 uses native widgets now. I don't think there are any specific applications; it's a general purpose library.
0
2,320
0
6
2010-10-19T15:57:00.000
python,tkinter
Is TkKinter widely used to build user interfaces?
0
2
2
3,970,297
1
0
0
In which kind of application is Tkinter usually used? I'm doing a project in Python in which I'm using it for the first time to build a simple user interface. I was wondering if this is widely used for specific applications, or mobile applications.. etc
false
3,970,255
0
0
0
0
PyQt is a python binding of the popular Qt GUI toolkit. its very comprehensive.Anyway tkinter is good to start with and later you can move to PyQt or wxWidgets
0
2,320
0
6
2010-10-19T15:57:00.000
python,tkinter
Is TkKinter widely used to build user interfaces?
0
2
2
3,971,297
1
0
0
I am using Qt 4.7 and PyQt 4.7 to build a multi-threaded GUI program. I've been carefully managing PyQt objects so that they stay in one UI thread to avoid synchronization issues and there is no problem in general. But sometimes, at the moment the python garbage collector is activated from other thread, the destructor of Qt object is called right there and the following assertion fails from inside Qt. I can define QT_NO_DEBUG even for the debug version and it should be fine because objects being collected hardly cause a synchronization problem. But still, I don't think that's a good idea to turn off other debug messages. How do I prevent this from happening? #if !defined (QT_NO_DEBUG) || defined (QT_MAC_FRAMEWORK_BUILD) void QCoreApplicationPrivate::checkReceiverThread(QObject *receiver) { QThread *currentThread = QThread::currentThread(); QThread *thr = receiver->thread(); Q_ASSERT_X(currentThread == thr || !thr, "QCoreApplication::sendEvent", QString::fromLatin1("Cannot send events to objects owned by a different thread. " "Current thread %1. Receiver '%2' (of type '%3') was created in thread %4") .arg(QString::number((quintptr) currentThread, 16)) .arg(receiver->objectName()) .arg(QLatin1String(receiver->metaObject()->className())) .arg(QString::number((quintptr) thr, 16)) .toLocal8Bit().data()); Q_UNUSED(currentThread); Q_UNUSED(thr); } #elif defined(Q_OS_SYMBIAN) && defined (QT_NO_DEBUG)
false
3,975,343
0.099668
0
0
1
I would recommend using pyqtSignal. You can create signals for your threads to send when their task is completed and the receiver becomes the signal's connected function.
1
1,981
0
5
2010-10-20T06:44:00.000
python,multithreading,qt,garbage-collection,pyqt
How to prevent PyQt objects from garbage collecting from different thread?
0
1
2
4,130,841
1
0
0
I have just made a small little app of a Python wxPython script with py2app. Everything worked as advertised, but the app is pretty big in size. Is there any way to optimize py2app to make the app smaller in size?
false
3,979,658
0.099668
0
0
1
py2app or any other such packager mostly bundles all dependencies and files together so that you could easily distribute them. The size is usually large as it bundles all dependencies , share libraries , packages along with your script file. In most cases, it will be difficult to reduce the size. How ever, you can ensure the following so that there is lesser cruft in the bundled application. Do not use --no-strip option, this will ensure that debug symbols are stripped. Use "--optimize 2 or -O2" optimization option Use "--strip (-S)" option to strip debug and local symbols from output Use "--debug-skip-macholib", it will not make it truly stand alone but will reduce the size I am hoping that you have removed unnecessary files from wxPython like demo, doc etc.
0
2,325
0
1
2010-10-20T15:40:00.000
python,optimization,wxpython,py2app
Slim down Python wxPython OS X app built with py2app?
0
1
2
3,980,702
1
0
0
Well i want to input a python function as an input in run time and execute that part of code 'n' no of times. For example using tkinter i create a textbox where the user writes the function and submits it , also mentioning how many times it wants to be executed. My program should be able to run that function as many times as mentioned by the user. Ps: i did think of an alternative method where the user can write the program in a file and then i can simply execute it as python filename as a system cmd inside my python program , but i dont want it that way.
false
3,981,357
0.132549
0
0
2
Python provides number of ways to do this using function calls: - eval() - exec() For your needs you should read about exec.
1
6,779
0
1
2010-10-20T19:02:00.000
python
how to input python code in run time and execute it?
0
1
3
3,981,399
1
0
0
I've got class A wrapped with method foo implemented using %extend: class A { ... %extend { void foo() { self->foo_impl(); } } Now I want to increase ref count to an A inside foo_impl, but I only got A* (as self). Question: how can I write/wrap function foo, so that I have an access both to A* and underlying PyObject*? Thank you
false
4,005,355
0.197375
0
0
1
I think it's not possible. If you need to increase the refcount, it's because you don't want the C++ object to be destroyed when it goes out of scope because there is a pointer to that object elsewhere. In that case, look at using the DISOWN typemap to ensure the target language doesn't think it "owns" the C++ object, so it won't get destroyed.
1
619
0
1
2010-10-23T18:02:00.000
c++,python,swig
Python Swig wrapper: how access underlying PyObject
0
1
1
4,026,127
1
0
0
Yes, that's what I need to achieve, don't ask why:) So, since this is mainly OS dependent stuff I will be using Windows or Linux (whatever is simpler) Every second my program will: 1. do a screenshot, analyze the board and other stuff (this I can do) 2. then move the mouse to some XY and do a left-click that's all My main concern is: is there any library for capturing screenshots and then left clicking somwhere on the screen?
false
4,007,847
0.066568
0
0
1
You can try to use Selenium RC + python driver for Selenium. There are means of making browser screenshot, and there is ClickAt method which takes coordinates.
0
784
0
2
2010-10-24T10:22:00.000
python,click,screenshot
python program that plays flash games for me
0
2
3
4,007,877
1
0
0
Yes, that's what I need to achieve, don't ask why:) So, since this is mainly OS dependent stuff I will be using Windows or Linux (whatever is simpler) Every second my program will: 1. do a screenshot, analyze the board and other stuff (this I can do) 2. then move the mouse to some XY and do a left-click that's all My main concern is: is there any library for capturing screenshots and then left clicking somwhere on the screen?
false
4,007,847
0.197375
0
0
3
I've done this very thing before - use PIL to get the screenshots, and pywinauto to generate the mouse clicks.
0
784
0
2
2010-10-24T10:22:00.000
python,click,screenshot
python program that plays flash games for me
0
2
3
4,700,444
1
0
0
I'm using "tkFileDialog.askopenfilename" to get a file name variable. I know that I can set the "initialdir" option, but not everyone who uses the program will have the target file on the same drive. For example: the file could be located on the C:, D:, E: etc... I don't see a way to view available drives with the dialog box they have open up. I'd like the user to be able to type something like "/h/cowsandstuff" and have it navigate to that directory instead of locking them in. I am programming in a Linux environment, BTW. The analogous function in Windows that I would like is the "My Computer" option in the drop down menu which would list all available drives...
true
4,017,129
1.2
0
0
2
Linux doesn't have those drive letters C:, D:, etc. In linux all filesystems of different drives are mounted on separate folders in the same tree structure, so you only have a single tree. Most distros use /media to mount pendrives etc, but hard drives can be configured to mount on any folder. So there's no such thing as "drive letter" in linux, your question doesn't apply.
0
1,219
0
0
2010-10-25T17:19:00.000
python,linux,tkinter,option
tkFileDialog.askopenfilename How to specify a different drive?
0
3
3
4,018,335
1
0
0
I'm using "tkFileDialog.askopenfilename" to get a file name variable. I know that I can set the "initialdir" option, but not everyone who uses the program will have the target file on the same drive. For example: the file could be located on the C:, D:, E: etc... I don't see a way to view available drives with the dialog box they have open up. I'd like the user to be able to type something like "/h/cowsandstuff" and have it navigate to that directory instead of locking them in. I am programming in a Linux environment, BTW. The analogous function in Windows that I would like is the "My Computer" option in the drop down menu which would list all available drives...
false
4,017,129
0
0
0
0
If you simply point to "/" it contains all mounted devices...
0
1,219
0
0
2010-10-25T17:19:00.000
python,linux,tkinter,option
tkFileDialog.askopenfilename How to specify a different drive?
0
3
3
4,028,422
1
0
0
I'm using "tkFileDialog.askopenfilename" to get a file name variable. I know that I can set the "initialdir" option, but not everyone who uses the program will have the target file on the same drive. For example: the file could be located on the C:, D:, E: etc... I don't see a way to view available drives with the dialog box they have open up. I'd like the user to be able to type something like "/h/cowsandstuff" and have it navigate to that directory instead of locking them in. I am programming in a Linux environment, BTW. The analogous function in Windows that I would like is the "My Computer" option in the drop down menu which would list all available drives...
false
4,017,129
0.066568
0
0
1
As nosklo sais, in Linux you don't have drive letters. Everything are paths. If the file can be in any path, I would expect that the user will known the path, but I would consider the next options: Default to the user's home path. You can directly use the ´~´and tk will convert it to the Linux home folder or the Windows User/My Documents path Remember the last path so you can use it in the future.
0
1,219
0
0
2010-10-25T17:19:00.000
python,linux,tkinter,option
tkFileDialog.askopenfilename How to specify a different drive?
0
3
3
4,028,563
1
0
0
I have a camera that is taking pictures one by one (about 10 pictures per second) and sending them to PC. I need to show this incoming sequence of images as a live video in PC. Is it enough just to use some Python GUI framework, create a control that will hold a single image and just change the image in the control very fast? Or would that be just lame? Should I use some sort of video streaming library? If yes, what do you recommend?
true
4,019,571
1.2
0
0
2
Or would that be just lame? No. It wouldn't work at all. There's a trick to getting video to work. Apple's QuickTime implements that trick. So does a bunch of Microsoft product. Plus some open source video playback tools. There are several closely-related tricks, all of which are a huge pain in the neck. Compression. Full-sized video is Huge. Do the math 640x480x24-bit color at 30 frames per second. It adds up quickly. Without compression, you can't read it in fast enough. Buffering and Timing. Sometimes the data rates and frame rates don't align well. You need a buffer of ready-to-display frames and you need a deadly accurate clock to get them do display at exactly the right intervals. Making a sequence of JPEG images into a movie is what iPhoto and iMovie are for. Usually, what we do is create the video file from the image and play the video file through a standard video player. Making a QuickTime movie or Flash movie from images isn't that hard. There are a lot of tools to help make movies from images. Almost any photo management solution can create a slide show and save it as a movie in some standard format. Indeed, I think that Graphic Converter can do this.
0
5,351
0
3
2010-10-25T23:04:00.000
python,video,video-streaming
The simplest video streaming?
0
1
1
4,020,278
1
0
0
I am using .kml file which points to an overlay image (presumably in UTM projection?). The KML file provides the latitudes and longitudes of the bounding box using the "LatLonBox" tag. I need to calculate the latitudes and longitudes of each pixel in this image. Are there any pre-existing libraries in Python that would do this for me?
true
4,019,611
1.2
0
0
0
The overlay image referenced by the kml file was in standard geographic projection. This means that the latitudes and longitudes vary linearly within the image. Calculating the latitude and longitude of each pixel became a trivial case of interpolation given that we already known the lat/lon bounds of the image provided by the LatLonBox tag attributes.
0
744
0
0
2010-10-25T23:11:00.000
python,geospatial,kml,latitude-longitude
How can I calculate the latitude and longitude of each pixel of an image in a kml file using Python?
0
1
1
4,026,507
1
0
0
I have a QTableView which displays data from a QSqlTableModel. I want my model to check for changes when a user hits a "refresh" button but I can't find a way to update the data. I tried the reset() and update() methods on the model without any result. Is it possible to "re-read" from the database and update the model? How?
true
4,022,049
1.2
0
0
5
As you dont state what you canged in your model, ill assume the simplest form of change (changed data). For me model.select() works to update the data in the model and force the View to update itself.
0
3,260
0
1
2010-10-26T08:53:00.000
python,pyqt,qtableview
Force Update QTableView + QSqlTableModel in PyQt
0
1
1
4,022,111
1
0
0
My needs : I need to develop an GUI application that is cross platform the chosen solution must be the fastest to implement it should be easy to extend The application is just a database front-end, mainly for CRUD operations, listing, filtering, exporting, charts and graphs etc. After reading about some solutions (Python Card, PyGUI, DABO, pygtkhelpers, kiwi, pyjamas, pure-mvc, PyQt/PySide, Wax, Tk-based frameworks, AVC, Fox etc.), I found myself interrested in two particular solutions, one of them is Camelot. Before jumping into it, I would like to have some opinions about Camelot users vs skeptics. Thanks for sharing :)
false
4,026,026
0
1
0
0
In my opinion the best option for this would be to make a CGI program to run through a browser so that you do not have to worry about platform issues. Granted it might take a little bit more work, it may be better suited for cross platform deployment. :)
0
593
0
3
2010-10-26T17:02:00.000
python,user-interface,sqlalchemy,cross-platform,python-elixir
Feedback for Camelot
0
2
2
9,863,280
1
0
0
My needs : I need to develop an GUI application that is cross platform the chosen solution must be the fastest to implement it should be easy to extend The application is just a database front-end, mainly for CRUD operations, listing, filtering, exporting, charts and graphs etc. After reading about some solutions (Python Card, PyGUI, DABO, pygtkhelpers, kiwi, pyjamas, pure-mvc, PyQt/PySide, Wax, Tk-based frameworks, AVC, Fox etc.), I found myself interrested in two particular solutions, one of them is Camelot. Before jumping into it, I would like to have some opinions about Camelot users vs skeptics. Thanks for sharing :)
false
4,026,026
0.099668
1
0
1
Disclaimer: I am a Camelot committer. If the question has been raised on the Programmers Stack Exchange, please link to it. This question is kind of old, but for any reference, i'll chime in. Camelot was and is developed for exactly the reasons you stated. It has matured a lot since this questions was asked and is about feature complete. Latest efforts have been made to use Declarative instead of Elixir. Stability and speed are strongpoints as well.
0
593
0
3
2010-10-26T17:02:00.000
python,user-interface,sqlalchemy,cross-platform,python-elixir
Feedback for Camelot
0
2
2
14,327,581
1
0
0
I have a Tkinter GUI where there is a Scale object. I have a callback assigned (by the command constructor parameter) to perform an action when the user changes the scale position. However, there is also a case where the value represented by the scale is modified externally, and so I set the scale position using Scale.set(). In this case, I want to set the scale, but not trigger the callback, since the rest of the program already knows about the change. However, I notice that the callback is indeed triggered by set(). Is it possible to do one of: Set the scale value without triggering the callback. Differentiate in the callback whether it was triggered by user interaction or by Scale.set() being called. Thanks.
true
4,038,517
1.2
0
0
2
There is nothing specifically built-in to Tkinter to solve this. It's really a simple problem to solve though: remove the callback, set the value, add the callback. Or, set a global flag and check for that flag in the callback. There are ways to solve the problem -- subclass the widget, for example -- but that doesn't really buy you anything. Just go with the simple solution and move on to more interesting problems.
0
2,247
0
4
2010-10-27T23:21:00.000
python,tkinter
Tkinter: Set a 'scale' value without triggering callback?
0
1
2
4,039,444
1
0
0
I'm a beginner in PyQt. I was trying to create a simple app to try some of the toolkit's many features. My question is, how can I hide the app icon from the taskbar? I don't want the user to be able to see the icon in taskbar and to minimize it using this icon. Is there any window flags that I can use to achieve this?
false
4,044,994
0
0
0
0
Just initialise your main window like this self.setWindowFlags(Qt.ToolTip)
0
7,171
0
12
2010-10-28T16:24:00.000
python,widget,pyqt4
Hide PyQt app from taskbar
0
1
6
67,350,685
1
0
0
I'm looking for a terminal UI library providing widgets like buttons, checkboxes and so on, that is compatible with python3. I've tried: pycdk (pyrex does not work with python3, and porting it is a mess) urwid (does not work with python3, it has a port but not working well with new curses interface). Does anyone know such a library? Thanks!
true
4,045,189
1.2
0
0
2
Cython supports Python 3, and I was able to make Cython accept the pyx file by changing all __new__ to __cinit__. Note that the examples still needs some porting to Python 3 at that point. I get "TypeError: expected bytes, str found" when trying to run the examples. Switching all the strings to bytes worked. Possibly it would be better if the API accepted strings under Python 3 too, but that is definitely more work.
0
537
0
2
2010-10-28T16:48:00.000
user-interface,python-3.x,widget,ncurses
Is there a terminal widget library compatible with Python 3?
0
1
1
4,993,662
1
0
0
I am running Python 3.1.2 with IDLE 3.1.2 on Windows 7. When I try to use the Stack Viewer, blue text and a new window briefly appear before all open IDLE windows exit (I don't have time to read the text or new window). This is the first time I have used Stack Viewer. Is this normal behavior? How can I get the Stack Viewer to stay open? Thanks for your help, Alex
false
4,046,021
0.132549
0
0
2
This IDLE bug (3 series only) was fixed 30Jan11. The fix is in 3.1.4 and 3.2.
1
1,247
0
0
2010-10-28T18:27:00.000
python,windows,windows-7,python-3.x,python-idle
(Python, IDLE, Windows) Pressing Stack Viewer exits all IDLE windows
0
2
3
8,859,539
1
0
0
I am running Python 3.1.2 with IDLE 3.1.2 on Windows 7. When I try to use the Stack Viewer, blue text and a new window briefly appear before all open IDLE windows exit (I don't have time to read the text or new window). This is the first time I have used Stack Viewer. Is this normal behavior? How can I get the Stack Viewer to stay open? Thanks for your help, Alex
false
4,046,021
0
0
0
0
I don't have Windows so I can't help you with hands-on experience, but I would do the following: see what is the exact command that runs when you click on the menu item for Idle (I think you can right-click and see its properties, or at least you could on earlier versions of Windows) open a command prompt, and run the command that opens Idle open the stack viewer and then note the traceback that (should!) appear in the command prompt window report said traceback here :) BTW, in my installation (neither Windows nor Python 3.x), an attempt to open the stack viewer without a traceback produces the following message box: Title: No stack trace Message: There is no stack trace yet. (sys.last_traceback is not defined)
1
1,247
0
0
2010-10-28T18:27:00.000
python,windows,windows-7,python-3.x,python-idle
(Python, IDLE, Windows) Pressing Stack Viewer exits all IDLE windows
0
2
3
4,047,313
1
0
0
so I've got this little Text widget with a scroll bar and I've got a question. How do I make text in this Text widget a variable ? If I made this text a variable I would be able to open a text file and edit it's text or save the text I've written, etc or maybe it's a wrong way that I'm approaching this, is there a better way to do this ?
true
4,055,017
1.2
0
0
5
There is no option to associate a variable with a text widget. You can achieve the same thing by using variable traces and widget bindings but it's rarely worth the effort. The typical way to interact with the text widget is to read a file into a variable then use the insert method of the widget to put the text into the widget. Then, to save you just do the reverse -- get the text from the widget with the get method, and write the data to a file. One tip: when you do a get, don't get the text from 1.0 to "end", use "end-1c" instead. If you specify "end" as the last character you'll get the implicit newline that tk always adds, meaning your text file will grow by one character each time you do a load/save cycle.
1
1,548
0
0
2010-10-29T19:01:00.000
python,user-interface,tkinter
Text in Text Widget as a variable
0
1
1
4,055,447
1
0
0
Any suggestions on how one might create event bindings that would allow a user to mouse drag a window without borders, eg. a window created with overridedirect(1)? Use case: We would like to create a floating toolbar/palette window (without borders) that our users can drag around on their desktop. Here's where I'm at in my thinking (pseudo code): window.bind( '<Button-1>', onMouseDown ) to capture the initial position of the mouse. window.bind( '<Motion-1>', onMouseMove ) to track position of mouse once it starts to move. Calculate how much mouse has moved and calculate newX, newY positions. Use window.geometry( '+%d+%d' % ( newX, newY ) ) to move window. Does Tkinter expose enough functionality to allow me to implement the task at hand? Or are there easier/higher-level ways to achieve what I want to do?
false
4,055,267
0.039979
0
0
1
Try this, and it surely works; Create an event function to move window: def movewindow(event): root.geometry('+{0}+{1}'.format(event.x_root, event.y_root)) Bind window: root.bind('', movewindow) Now you can touch the the window and drag
0
20,122
0
17
2010-10-29T19:35:00.000
python,windows,user-interface,window,tkinter
Tkinter: Mouse drag a window without borders, eg. overridedirect(1)
0
1
5
41,426,823
1
0
0
Are Tkinter StringVar (IntVar, FloatVar, etc) thread safe, eg. can a background thread read or write to these objects? Or must I use a Queue to pass information between my background thread and my main Tkinter GUI thread and have my main Tkinter thread pop the Queue and update the application's StringVar's accordingly? I know my application's background threads must not read or write a Tkinter widget directly but I'm unclear on whether StringVar's (or their ilk) are considered widgets or if they are objects far enough removed from widgets that they are thread safe for background threads to read and/or write.
false
4,058,878
0
0
0
0
Definitely go the Queue route. Nothing in Tkinter is setup for being threadsafe :(
1
1,582
0
3
2010-10-30T13:26:00.000
python,multithreading,user-interface,tkinter
Python/Tkinter: Are Tkinter StringVar (IntVar, etc) thread safe?
0
1
1
5,036,358
1
0
0
I just downloaded the original Python interpreter from Python's site. I just want to learn this language but to start with, I want to write Windows-based standalone applications that are powered by any RDBMS. I want to bundle it like any typical Windows setup. I searched old posts on SO and found guys suggesting wxPython and py2exe. Apart from that few suggested IronPython since it is powered by .NET. I want to know whether IronPython is a pure variant of Python or a modified variant. Secondly, what is the actual use of Python? Is it for PHP like thing or like C# (you can either program Windows-based app. or Web.).
true
4,059,201
1.2
1
0
6
IronPython isn't a variant of Python, it is Python. It's an implementation of the Python language based on the .NET framework. So, yes, it is pure Python. IronPython is caught up to CPython (the implementation you're probably used to) 2.6, so some of the features/changes seen in Python 2.7 or 3.x will not be present in IronPython. Also, the standard library is a bit different (but what you lose is replaced by all that .NET has to offer). The primary application of IronPython is to script .NET applications written in C# etc., but it can also be used as a standalone. IronPython can also be used to write web applications using the SilverLight framework. If you need access to .NET features, use IronPython. If you're just trying to make a Windows executable, use py2exe. Update For writing basic RDBMS apps, just use CPython (original Python), it's more extensible and faster. Then, you can use a number of tools to make it stand alone on a Windows PC. For now, though, just worry about learning Python (those skills will mostly carry over to IronPython if you choose to switch) and writing your application.
0
1,297
0
4
2010-10-30T14:49:00.000
python,wxpython,ironpython
Is IronPython a 100% pure Python variant?
0
3
4
4,059,227
1
0
0
I just downloaded the original Python interpreter from Python's site. I just want to learn this language but to start with, I want to write Windows-based standalone applications that are powered by any RDBMS. I want to bundle it like any typical Windows setup. I searched old posts on SO and found guys suggesting wxPython and py2exe. Apart from that few suggested IronPython since it is powered by .NET. I want to know whether IronPython is a pure variant of Python or a modified variant. Secondly, what is the actual use of Python? Is it for PHP like thing or like C# (you can either program Windows-based app. or Web.).
false
4,059,201
0.049958
1
0
1
IronPython is an implementation of Python using C#. It's just like the implementation of Python using Java by Jython. You might want to note that IronPython and Jython will always lag behind a little bit in development. However, you do get the benefit of having some libraries that's not available in the standard Python libraries. In IronPython, you will be able to get access to some of the .NET stuff, like System.Drawings and such, though by using these non-standard libraries, it will be harder to port your code to other platforms. For example, you will have to install mono to run apps written in IronPython on Linux (On windows you will need the .NET Framework)
0
1,297
0
4
2010-10-30T14:49:00.000
python,wxpython,ironpython
Is IronPython a 100% pure Python variant?
0
3
4
4,059,540
1
0
0
I just downloaded the original Python interpreter from Python's site. I just want to learn this language but to start with, I want to write Windows-based standalone applications that are powered by any RDBMS. I want to bundle it like any typical Windows setup. I searched old posts on SO and found guys suggesting wxPython and py2exe. Apart from that few suggested IronPython since it is powered by .NET. I want to know whether IronPython is a pure variant of Python or a modified variant. Secondly, what is the actual use of Python? Is it for PHP like thing or like C# (you can either program Windows-based app. or Web.).
false
4,059,201
0.049958
1
0
1
what does "Pure Python" mean? If you're talking about implemented in Python in the same sense that a module may be pure python, then no, and no Python implementation is. If you mean "Compatible with cPython" then yes, code written to cPython will work in IronPython, with a few caveats. The one that's likely to matter most is that the libraries are different, for instance code depending on ctypes or Tkinter won't work. Another difference is that IronPython lags behind cPython by a bit. the very latest version of this writing is 2.6.1, with an Alpha version supporting a few of the 2.7 language features available too. What do you really need? If you want to learn to program with python, and also want to produce code for windows, you can use IronPython for that, but you can also use cPython and py2exe; both will work equally well for this with only differences in the libraries.
0
1,297
0
4
2010-10-30T14:49:00.000
python,wxpython,ironpython
Is IronPython a 100% pure Python variant?
0
3
4
4,059,291
1
0
0
I'm experimenting with PyQT, and I was trying to figure out how to get it to work with Firebird. I built the Firebird driver, but couldn't get it to work, so I was thinking maybe I wasn't putting it in the right place. So I tried experimenting with the SQLite driver, since PyQT came with it already installed, with working examples. I figured if I renamed all the qsqlite4.dll driver files I could find, eventually the example program would stop working when I renamed the one it was actually using. That didn't work. So I tried renaming the "site-packages\pyqt4\plugins\sqldrivers" folder to "site-packages\pyqt4\plugins\sqldrivers-old", and that did it. The example program stopped working. So I changed the folder name back, and tried renaming all the files in the folder. But the example program started working again. Then I moved the qsqlite4.dll file to a subdirectory, and it stopped working. So I moved it back, and renamed it to blah.blah.blah. And it worked again. Then I opened up blah.blah.blah with notepad++, and deleted some stuff at the top of the file, and that kept the example program from working. So I'm confused. As far as I can tell, either Python, PyQT, QT, or Windows Vista is finding the dll, no matter what I rename it to, as long as it's in the right folder. I even tried renaming it to the name of one of the other dll's, thinking maybe that would confuse it. But it only confused me. Is this normal? edit: I'm thinking this has something to do with plugins
false
4,068,906
0
0
0
0
Yes, Qt plugin infrastructure is a fairly simple and robust one. It attempts to load every file in sqldrivers directory. If it is successful, each dll then runs a function that registers all the features such a plugin supports. Then, you application initalizes. If all the features it needs are available, it works properly, otherwise, some form of error or exception handling occurs.
0
284
0
0
2010-11-01T12:37:00.000
python,dll,windows-vista,qt4,pyqt4
Either Python, PyQT, QT, or Windows Vista is finding my dll, no matter what I rename it to. Is this normal?
0
1
1
4,453,952
1
0
0
I'm currently making a 2D side-scrolling run'n'jump platform game in PyGame. Most of the stuff is working OK and very well in fact - I am exploiting the fast pyGame Sprite objects & groups. What I'm interested to know is how people usually deal with Rects for scrolling games. I obviously have a level that is much bigger than visible area, and the player, enemies, bullets etc each have their own (x,y) coordinates which describe where they are in the level. But now, since we use the "spriteGroup.draw(surface)" call, it will not display them in the right spot unless each objects Rects have been adjusted so that the right part displays on the screen. In other words, everytime a player/enemy/bullet/whatever else is updated, the Camera information needs to be passed, so that their Rect can be updated. Is this the best method to use? It works but I don't really like passing the camera information to every single object at every update to offset the Rects. Obviously the ideal method (I think) is to use Rects with "real" coordinates, blit everything to a buffer as big as the level, and then just blit the visible part to the screen, but in practice that slows the game down A LOT. Any comments/insight would be appreciated. Thanks
false
4,073,928
0
0
0
0
You can have a 2 variables level_landlevel_d which see where you are in the level, Then check which sprites are in the visible area level_d+height and level_l+width, and draw them on the screen.
0
1,235
0
2
2010-11-01T23:21:00.000
python,scroll,2d,pygame
Pygame: Updating Rects with scrolling levels
0
3
5
14,293,575
1
0
0
I'm currently making a 2D side-scrolling run'n'jump platform game in PyGame. Most of the stuff is working OK and very well in fact - I am exploiting the fast pyGame Sprite objects & groups. What I'm interested to know is how people usually deal with Rects for scrolling games. I obviously have a level that is much bigger than visible area, and the player, enemies, bullets etc each have their own (x,y) coordinates which describe where they are in the level. But now, since we use the "spriteGroup.draw(surface)" call, it will not display them in the right spot unless each objects Rects have been adjusted so that the right part displays on the screen. In other words, everytime a player/enemy/bullet/whatever else is updated, the Camera information needs to be passed, so that their Rect can be updated. Is this the best method to use? It works but I don't really like passing the camera information to every single object at every update to offset the Rects. Obviously the ideal method (I think) is to use Rects with "real" coordinates, blit everything to a buffer as big as the level, and then just blit the visible part to the screen, but in practice that slows the game down A LOT. Any comments/insight would be appreciated. Thanks
false
4,073,928
0
0
0
0
One method I found is to keep track of a scrollx and a scrolly. Then, just add scrollx and scroll y to the coordinates when you move the rectangles.
0
1,235
0
2
2010-11-01T23:21:00.000
python,scroll,2d,pygame
Pygame: Updating Rects with scrolling levels
0
3
5
14,189,213
1
0
0
I'm currently making a 2D side-scrolling run'n'jump platform game in PyGame. Most of the stuff is working OK and very well in fact - I am exploiting the fast pyGame Sprite objects & groups. What I'm interested to know is how people usually deal with Rects for scrolling games. I obviously have a level that is much bigger than visible area, and the player, enemies, bullets etc each have their own (x,y) coordinates which describe where they are in the level. But now, since we use the "spriteGroup.draw(surface)" call, it will not display them in the right spot unless each objects Rects have been adjusted so that the right part displays on the screen. In other words, everytime a player/enemy/bullet/whatever else is updated, the Camera information needs to be passed, so that their Rect can be updated. Is this the best method to use? It works but I don't really like passing the camera information to every single object at every update to offset the Rects. Obviously the ideal method (I think) is to use Rects with "real" coordinates, blit everything to a buffer as big as the level, and then just blit the visible part to the screen, but in practice that slows the game down A LOT. Any comments/insight would be appreciated. Thanks
false
4,073,928
0.039979
0
0
1
You could extend de Sprite.Group so it recives the camera information. Then do one of these options: A. Override the update method so it updates the on-screen coordinates of every sprite. B. Override the draw method so it updates the on-screen coordinates of every sprite and then calls its parent draw method. I think A it's easier and cleaner.
0
1,235
0
2
2010-11-01T23:21:00.000
python,scroll,2d,pygame
Pygame: Updating Rects with scrolling levels
0
3
5
4,077,600
1
0
0
I'm working with Sikuli, which (I think) is build on Jython. I want to make a script that does a small gentle beep to attract the user's attention. (This is on Windows.) How can I do this? I see that the winsound module is not available on Jython. (Note that I want to use the sound card, not the built-in beeper.)
false
4,078,734
0.132549
0
0
4
If its Jython, then just use any of the Java classes that play sound. There are tons of them. from java import net from java.applet.Applet import newAudioClip from java import io url = io.File("fileName").toURL() audio = newAudioClip(url) audio.play() import sun.audio import java.io inputStream = java.io.FileInputStream("test.wav") audioStream = sun.audio.AudioStream(inputStream) sun.audio.AudioPlayer.player.start(audioStream)
1
2,323
0
7
2010-11-02T14:38:00.000
python,windows,audio,jython,sikuli
Jython: Making a simple beep on Windows
0
3
6
4,079,110
1
0
0
I'm working with Sikuli, which (I think) is build on Jython. I want to make a script that does a small gentle beep to attract the user's attention. (This is on Windows.) How can I do this? I see that the winsound module is not available on Jython. (Note that I want to use the sound card, not the built-in beeper.)
false
4,078,734
0
0
0
0
Since you are using Sikuli you can to the following. Add any mediafile such as any .mp3 on the desktop of a windows machine, asociate the file to a media player. Capture the image and include: click(pattern(desktopnoiseicon.png) alternatley you could execute the same task with openApp(C:\noise.mp3) Sikuli gives the ability to find numerous workarounds in SikuluXrc2 you could even point to a URL from your code without the need of setting a bundle path
1
2,323
0
7
2010-11-02T14:38:00.000
python,windows,audio,jython,sikuli
Jython: Making a simple beep on Windows
0
3
6
4,987,576
1
0
0
I'm working with Sikuli, which (I think) is build on Jython. I want to make a script that does a small gentle beep to attract the user's attention. (This is on Windows.) How can I do this? I see that the winsound module is not available on Jython. (Note that I want to use the sound card, not the built-in beeper.)
false
4,078,734
0.066568
0
0
2
You may do the fllowing using command line: Execute "copy con beep.txt" type [ctrl+G] as input and then [ctrl+Z] followed by [Enter] to exit Then run "type beep.txt" and you will hear a beep. You may place "type beep.txt" in a batch file or use Ctrl+G directly in batch (which would produce error in command line with sound)
1
2,323
0
7
2010-11-02T14:38:00.000
python,windows,audio,jython,sikuli
Jython: Making a simple beep on Windows
0
3
6
5,165,371
1
0
0
Is there a good wxpython GUI builder that does not require much coding, like in the case of the form builder in MS visual studio ?
false
4,079,866
0.197375
0
0
5
In addition to those, some people really like the XRCed application that's included with wxPython. Basically you create your GUI in XML. There's also the defunct Boa Constructor that I see people still using on the wxPython user's list.
0
46,286
0
29
2010-11-02T16:33:00.000
python,wxpython,gui-builder
A good wxpython GUI builder?
0
2
5
4,080,817
1
0
0
Is there a good wxpython GUI builder that does not require much coding, like in the case of the form builder in MS visual studio ?
false
4,079,866
0
0
0
0
You can use ezWxPython. it is not gui builder, but it helps you make layout easy same way as pySimpleGUI.
0
46,286
0
29
2010-11-02T16:33:00.000
python,wxpython,gui-builder
A good wxpython GUI builder?
0
2
5
55,686,053
1
0
0
I want basically to be able to use a Canvas as a meta container for other widgets. I want to divide my GUI into a left, center and middle section. Within each section I would like to be able to place widgets like: Checkbutton, Button, Label, etc. How to place widgets in a Canvas widget?
true
4,080,413
1.2
0
0
6
Your choices depend on what you're really trying to accomplish. Why is using a canvas preferable to using a frame? You can easily add widgets to a canvas just like you do any other container, using pack or grid or place. when you do this, the items will not scroll when you scroll the canvas because they aren't actually part of the canvas. The other choice is to create window objects on the canvas. You do this with the create_window method of the canvas. The advantage is, this window becomes part of the canvas and will scroll along with any other objects on the canvas. The downside is, your only option is absolute placement and you have to explicitly control the size of the widgets.
0
4,505
0
4
2010-11-02T17:30:00.000
python,python-3.x,widget,tkinter-canvas
How to place a widget in a Canvas widget in Tkinter?
0
1
1
4,080,471
1
0
0
Problem: I have a gtk.Dialog. Whenever the 'minimize' button on the dialog is clicked, the window is destroyed. Question: How can I connect to the minimize button of a gtk.Dialog so that I can iconify the window?
true
4,081,020
1.2
0
0
0
Are you sure it's the minimize button? Because GTK doesn't deal with (or even know about the existence of) minimize buttons at all, they are part of the window manager.
0
129
0
0
2010-11-02T18:40:00.000
python,user-interface,gtk,pygtk
Problems Connecting to Minimized Signal
0
1
1
4,085,525
1
0
0
Does Tkinter provide a way to temporarily turn off screen updates (when performing a large amount of screen activity) and then turn on screen updates when the UI updates are complete? Many GUI frameworks have this feature. wxPython provides Freeze and Thaw methods for this functionality. The Windows Win32api supports this as well via LockWindowUpdate( hWnd | 0 ). Googling on "tkinter freeze thaw" and "tkinter lockwindowupdate" came up emtpy.
true
4,088,996
1.2
0
0
1
No, Tkinter has no such thing. However, the screen is only updated via the event loop, so if all of your "large amount of screen activity" is happening in a single method, none of the activity will show up until your method finishes and the event loop is re-entered (or you explicitly call .update_idletasks())
0
968
0
1
2010-11-03T16:01:00.000
python,user-interface,tkinter,pywin32,win32ole
Python/Tkinter: Turn on/off screen updates like wxPython Freeze/Thaw?
0
1
1
4,091,168
1
0
0
im using wxpython 2.8 ansi with python 2.6 ,and richtext class seems to not exist as an error message prompts that wx module does not contain richtext attribute, i've searched the web but couldn't find a clear answer,therefore i come to you:) any thoughts? thanks in advance Nataly
true
4,092,333
1.2
0
0
1
You access the rich text control like this: import wx.richtext Or you pass the wx.TextCtrl the wx.TE_RICH or wx.TE_RICH2 flag. I've heard that the richtext widget isn't available on *nix though. Did you try the wxPython Demo? That's usually the best place to look to find out how to use a widget.
0
427
0
0
2010-11-03T22:46:00.000
python,wxpython
Is wx.richtext supported in wxpython 2.8?
0
2
2
4,101,577
1
0
0
im using wxpython 2.8 ansi with python 2.6 ,and richtext class seems to not exist as an error message prompts that wx module does not contain richtext attribute, i've searched the web but couldn't find a clear answer,therefore i come to you:) any thoughts? thanks in advance Nataly
false
4,092,333
0.099668
0
0
1
I just downloaded and installed version 2.8.11-ansi. RichTextControl is the first demo listed, and works fine. It sounds like there is something messed up with your installation. Unless you have to support windows 98/ME, I don't know any good reason to prefer the ansi version over unicode. Can you provide the exact text of the error message, and a listing of your site-packages, and the contents of wx.pth
0
427
0
0
2010-11-03T22:46:00.000
python,wxpython
Is wx.richtext supported in wxpython 2.8?
0
2
2
4,093,711
1
0
0
I'm creating a file dialog that allows the user to save a file after editing it in my app. I want to add a checkbox to the dialog so the user can make some choices about what format the file is saved in. I think I need to make some new class that inherits from FileDialog and inserts a checkbox into the frame created by the filedialog, but I don't really know how to do that. Can anyone help me out? (I also want to create an analogous file dialog for opening a file, but I assume that will just mean replacing the SAVE style with the OPEN style.)
false
4,093,819
0.099668
0
0
2
In wxWidgets 2.9 custom controls can be added to file dialogs using wxFileDialog::SetExtraControlCreator(). It's implemented for GTK, MSW and generic dialogs. Alternatively, you may use the wxFileCtrl class. It has native implementation only in wxGTK. I don't know if these features is available from Python wrappers, though.
0
2,300
0
2
2010-11-04T04:07:00.000
wxpython,wxwidgets,openfiledialog,savefiledialog,filedialog
How do I add widgets to a file dialog in wxpython?
0
2
4
5,943,314
1
0
0
I'm creating a file dialog that allows the user to save a file after editing it in my app. I want to add a checkbox to the dialog so the user can make some choices about what format the file is saved in. I think I need to make some new class that inherits from FileDialog and inserts a checkbox into the frame created by the filedialog, but I don't really know how to do that. Can anyone help me out? (I also want to create an analogous file dialog for opening a file, but I assume that will just mean replacing the SAVE style with the OPEN style.)
false
4,093,819
0.099668
0
0
2
I have to disagree with the sentiment that you should use standard dialogs only how they were designed. I take another view and would rather look at using subclassing the way that subclassing was intended. And to me, it is to add additional functionality/specialization to a class. So it is not changing the behavior of the standard dialog. It is creating a new dialog BASED ON the standard dialog with a little additional functionality. In my case, I want to add two buttons to the wx.MultiChoiceDialog to provide a Select All and/or Unselect All functions.
0
2,300
0
2
2010-11-04T04:07:00.000
wxpython,wxwidgets,openfiledialog,savefiledialog,filedialog
How do I add widgets to a file dialog in wxpython?
0
2
4
12,428,450
1
0
0
there are some people? i have some question about wxpython , can i use panel without a frame?
false
4,096,417
0.462117
0
0
5
The simple answer is "no". The panel is not a TopLevelWindow. Top level windows are Frames and Windows. Panels typically go in Frames, although you can nest panels in panels or frames. Telling us what to do, as Ryan suggested, would be the best way to get a good answer though.
0
588
0
0
2010-11-04T12:02:00.000
python,wxpython,wxwidgets
can i use panel without a frame in wxpython?
0
1
2
4,101,554
1
0
0
I am loading an IronPython script from a database and executing it. This works fine for simple scripts, but imports are a problem. How can I intercept these import calls and then load the appropriate scripts from the database? EDIT: My main application is written in C# and I'd like to intercept the calls on the C# side without editing the Python scripts. EDIT: From the research I've done, it looks like creating your own PlatformAdaptationLayer is the way you're supposed to to implement this, but it doesn't work in this case. I've created my own PAL and in my testing, my FileExsists method gets called for every import in the script. But for some reason it never calls any overload of the OpenInputFileStream method. Digging through the IronPython source, once FileExists returns true, it tries to locate the file itself on the path. So this looks like a dead end.
false
4,105,804
0.049958
1
0
1
You can re-direct all I/O to the database using the PlatformAdaptationLayer. To do this you'll need to implement a ScriptHost which provides the PAL. Then when you create the ScriptRuntime you set the HostType to your host type and it'll be used for the runtime. On the PAL you then override OpenInputFileStream and return a stream object which has the content from the database (you could just use a MemoryStream here after reading from the DB). If you want to still provide access to file I/O you can always fall back to FileStream's for "files" you can't find.
0
2,738
0
9
2010-11-05T12:25:00.000
import,ironpython
Custom IronPython import resolution
0
1
4
4,111,764
1
0
0
I'm looking for suggestions on how one might implement a toolbar that provides edit cut, copy, paste commands using the Tkinter framework. I understand how to build a toolbar and bind the toolbar commands, but I'm confused over how the toolbar button bound commands will know which widget to apply the cut, copy, or paste action because the widget with edit activity will lose focus when the toolbar button is clicked. My first thought was to have each widget with potential edit activity set a global variable when the widget gains focus and have other widgets (without edit activity, eg. buttons, sliders, checkbox/radiobox, etc) clear this global variable. But this sounds complicated to maintain unless I build a framework of widgets that inherit this behavior. Is there a simpler way to go about this or am I on the right track?
false
4,111,049
0.197375
0
0
2
You don't have to maintain a big framework, you can create a single binding on the root widget for <FocusIn> and put all the logic in that binding. Or, use focus_class and bind to the class all. Binding on the root will only affect children of the root, binding to all will affect all widgets in the entire app. That only matters if you have more than one toplevel widget.
0
1,053
0
0
2010-11-05T23:48:00.000
python,tkinter,clipboard,toolbar
Python/Tkinter: Building a toolbar that provides edit cut, copy, paste commands
0
2
2
4,111,218
1
0
0
I'm looking for suggestions on how one might implement a toolbar that provides edit cut, copy, paste commands using the Tkinter framework. I understand how to build a toolbar and bind the toolbar commands, but I'm confused over how the toolbar button bound commands will know which widget to apply the cut, copy, or paste action because the widget with edit activity will lose focus when the toolbar button is clicked. My first thought was to have each widget with potential edit activity set a global variable when the widget gains focus and have other widgets (without edit activity, eg. buttons, sliders, checkbox/radiobox, etc) clear this global variable. But this sounds complicated to maintain unless I build a framework of widgets that inherit this behavior. Is there a simpler way to go about this or am I on the right track?
true
4,111,049
1.2
0
0
1
You can tell the toolbar buttons to not take the focus; it's a configuration option and no UI guidelines I've ever seen have had toolbar buttons with focus. (Instead, the functionality is always available through some other keyboard-activatable mechanism, e.g., a hotkey combo.)
0
1,053
0
0
2010-11-05T23:48:00.000
python,tkinter,clipboard,toolbar
Python/Tkinter: Building a toolbar that provides edit cut, copy, paste commands
0
2
2
4,111,334
1
0
0
I have a complicated algorithm that updates 3 histograms that are stored in arrays. I want to debug my algorithm, so I was thinking of showing the arrays as histograms in a user interface. What is the easiest way to do this. (Rapid application development is more important than optimized code.) I have some experience with Qt (in C++) and some experience with matplotlib. (I'm going to leave this question open for a day or two because it's hard for me to evaluate the solutions without a lot more experience that I don't have. Hopefully, the community's votes will help choose the best answer.)
false
4,129,697
0.049958
0
0
1
I recommend using matplotlib in interactive mode, if you call .show once then it will pop up in its own window, if you don't then it exists only in memory and can be written to a file when you're done with it.
0
37,324
0
20
2010-11-09T01:28:00.000
python,matplotlib,pyqt,vispy
How do I display real-time graphs in a simple UI for a python program?
0
1
4
4,129,787
1
0
0
I'm studying the Tkinter Listbox widget and have been unable to find solutions for the following functionality: How can I create non-selectable horizontal separator items, eg. separators equivalent to the Tkinter Menu widget's .add_separator()? (Using chars like dashes and underscores looks awful). How can I disable a specific item? I tried using .itemconfig( index, state='disabled' ) without success. How can I enable keyboard navigation, eg. when a user's keyboard input automatically scrolls one forward to the closest item that begins with the text the user typed? Must I bind(<KeyPress>, ...) and manage this behavior myself? Would some of the above functionality be easier to implement using a Text widget or the ttk.Treeview widget?
true
4,140,396
1.2
0
0
5
you cannot. The widget doesn't support that. you can't disable certain items, the widget doesn't support a state attribute. That being said, you can monitor the selection and do the appropriate thing if the user selects something that is disabled, and use the item foreground to denote disabled-ness. You will need to bind to keypress events and manage the behavior yourself. It's not particularly difficult, just a little tedious. the text widget might be your best bet, though you'll have to add bindings to mimic the default bindings of the listbox. Bottom line: Tkinter provides nothing that directly supports what you want to do, but the building blocks are all there. You'll just have to build it yourself.
0
2,343
0
4
2010-11-10T01:15:00.000
python,user-interface,listbox,tkinter,ttk
Tkinter: Listbox separators, disabled items, keyboard navigation?
0
1
1
4,141,054
1