Web Development
int64
0
1
Data Science and Machine Learning
int64
0
1
Question
stringlengths
35
6.31k
is_accepted
bool
2 classes
Q_Id
int64
5.14k
40.5M
Score
float64
-1
1.2
Other
int64
0
1
Database and SQL
int64
0
1
Users Score
int64
-6
163
Answer
stringlengths
19
4.91k
Python Basics and Environment
int64
0
1
ViewCount
int64
12
475k
System Administration and DevOps
int64
0
1
Q_Score
int64
0
346
CreationDate
stringlengths
23
23
Tags
stringlengths
6
68
Title
stringlengths
12
138
Networking and APIs
int64
0
1
Available Count
int64
1
31
AnswerCount
int64
1
35
A_Id
int64
5.3k
72.3M
GUI and Desktop Applications
int64
1
1
0
0
I've incorporated IronPython into my XNA game on Windows, but, of course, that won't work on the compact framework since the DLR stuff isn't available. Are there any scripting object implementations available that will work with the compact framework? It's really convenient to be able to tweak the system real-time without having to recompile.
false
4,556,096
0.197375
0
0
1
Most things in IronRuby will work on the compact framework (it runs on Windows Phone today). You may need to deploy the DLR yourself but because it's just an additional library it is possible to run it. IronPython could be made to work but it'll require some work to avoid doing code generation where it does today which is not possible on the compact framework.
0
446
0
1
2010-12-29T17:05:00.000
ironpython,xbox360,xna-4.0
XNA - scripting on XBOX?
0
1
1
4,566,611
1
0
0
Is there a way to check if part or an entire window is over/under another window in python? I have two windows and I'd like to make them not appear over each other. This is in Windows, using Tkinter.
true
4,566,330
1.2
0
0
1
You can use the methods winfo_rootx and winfo_rooty to get the x/y in the upper left corner. You can use winfo_width and winfo_height to get the width and height of the window. From that it's just a little math to figure out if two windows overlap. You can then use the geometry method to position the windows anywhere on the screen.
1
79
0
1
2010-12-30T21:15:00.000
python,tkinter
Making windows not appear over each other
0
1
1
4,570,554
1
1
0
I want to create a somehow complex application: It is a game level editor. You can put in tiles and other objects for a level. Then "compress" the level data into a file. With another application, it will read the file's data and play the game. The application is for Windows mainly. Other platforms are yet to be considered. So I need help deciding: If you were to do something like what I described, which programming language would you choose? I want to decide between Ruby or Python. I want you to help me choose depending on my following needs: Easy GUI platform for making the editor. Can show sprites, move, transform them etc. Can play audio. Can compress data, graphics and audio. The compressed file can only be read by another application I make.
false
4,577,156
0.099668
1
0
1
I've never used Ruby but I'm sure there is virtually no difference between the 2 when it comes to libraries. I know what you want can be done with Python using wxPython or pygame (or the combination of two). But I'm sure there are similar libs for Ruby. So just look at both languages and use the one you like better.
0
955
0
0
2011-01-02T04:38:00.000
python,ruby,user-interface
Making a somehow complex application: Ruby vs Python
0
2
2
4,577,169
1
1
0
I want to create a somehow complex application: It is a game level editor. You can put in tiles and other objects for a level. Then "compress" the level data into a file. With another application, it will read the file's data and play the game. The application is for Windows mainly. Other platforms are yet to be considered. So I need help deciding: If you were to do something like what I described, which programming language would you choose? I want to decide between Ruby or Python. I want you to help me choose depending on my following needs: Easy GUI platform for making the editor. Can show sprites, move, transform them etc. Can play audio. Can compress data, graphics and audio. The compressed file can only be read by another application I make.
true
4,577,156
1.2
1
0
4
Python + PyGame. Hands down. You will benefit from: Good docs for both the language and PyGame GUI, sprites, and audio all in one, again with PyGame Better Windows support than Ruby (you can install both Python and PyGame from .exes) Desktop applications (esp. for Windows) aren't really Ruby's sweet spot. PyGame will serve your purposes perfectly, though. That's not to say you couldn't do it with Ruby; you could write this in any language. But for ease of use, Python is the way to go.
0
955
0
0
2011-01-02T04:38:00.000
python,ruby,user-interface
Making a somehow complex application: Ruby vs Python
0
2
2
4,577,168
1
0
0
I'd like to try my hand at some PC game development. I keep hearing that python is slow compared to C++. Is this something I should be worried about? I am more familiar with python than C++. If I'm looking to make some games, should I take the time to learn C++ or just stick with Python?
false
4,578,307
0.158649
1
0
4
The kind of game matters immensely. High performance games like the big name PC or console games are almost exclusively the domain of C++. Casual games can be written in almost any language, including slower languages like Python. If you're a garage type developer who gets his hands wet with some simple game development for this first time, Python would be more than enough. If you however have the ambition to work for a game developer studio, I would definitely recommend learning C++.
1
13,393
0
8
2011-01-02T12:15:00.000
python,performance
How "slow" is python for game development?
0
4
5
4,578,373
1
0
0
I'd like to try my hand at some PC game development. I keep hearing that python is slow compared to C++. Is this something I should be worried about? I am more familiar with python than C++. If I'm looking to make some games, should I take the time to learn C++ or just stick with Python?
false
4,578,307
1
1
0
6
Elebenty-seven. No, really, it's fast enough for most things, and can drop to C when you really need speed. Profile twice, optimize once.
1
13,393
0
8
2011-01-02T12:15:00.000
python,performance
How "slow" is python for game development?
0
4
5
4,578,311
1
0
0
I'd like to try my hand at some PC game development. I keep hearing that python is slow compared to C++. Is this something I should be worried about? I am more familiar with python than C++. If I'm looking to make some games, should I take the time to learn C++ or just stick with Python?
false
4,578,307
-0.119427
1
0
-3
C++ is much more easier for object orientation. When you're doing things, it's easier to keep track of everything, because most IDEs for C++ are more based on projects, were as IDLE is more based on single files. The bottom line is for game development, use what you're comfortable with using. I mean, game development is about what you want to do, not what would be better, because better == what you want.
1
13,393
0
8
2011-01-02T12:15:00.000
python,performance
How "slow" is python for game development?
0
4
5
15,419,304
1
0
0
I'd like to try my hand at some PC game development. I keep hearing that python is slow compared to C++. Is this something I should be worried about? I am more familiar with python than C++. If I'm looking to make some games, should I take the time to learn C++ or just stick with Python?
false
4,578,307
0.07983
1
0
2
Many if not most top-end commercial games these days include some kind of scripting engine for game logic. Game logic decisions, for the most part, aren't particularly performance-sensitive in the way that e.g. the rendering engine is. BTW - I'm not claiming any insider knowledge of game development - this is fairly well known outside the industry. Some games publishers have even allowed users access to the scripting stuff and other tools for games modding - for years. If you find a game engine that is wrapped to be used in Python, you'll be dealing with the same basic principles. Write the game logic in Python, and you'll probably be fine. PyGame is basically SDL wrapped for Python, supporting basic 2D games for the most part (though OpenGL can be used for 3D in SDL - not sure for PyGame). It's a good starting point. You may hit a performance issue with managing your game objects and running your blit loop, since only very basic graphics stuff is handled by SDL, but you should find that it's just fine for most things. As Ignacio implies - worry about performance problems when you know you have performance problems, not before. Some performance problems are predictable in advance, but if you're not writing the actual game engine in Python, you should be OK - don't fall into the premature optimisation trap, IOW.
1
13,393
0
8
2011-01-02T12:15:00.000
python,performance
How "slow" is python for game development?
0
4
5
4,578,381
1
0
0
Is there a PyQt3 (Or 4) Windows binary installer for Python 2.3? I've googled around for an hour now but to no avail. Why am I using version 2.3? With my project file size is paramount. Without the interface, un-needed modules and compressing using UPX the resulting .exe size is a mear 750KB's. Just need to add the interface which will beaf the size up considerably I know but it will still be a good size. So anyone know how I can install PyQt3 or 4 with Python2.3?
false
4,588,045
0.291313
0
0
3
Python 2.3 is extremely old. You really shouldn't be using it at all. I seriously doubt there's any qt bindings for it that would even compile. Why do you think using python 2.3 will save you so much file size? Adding pyqt will probably increase your file size by 10s of megabytes at least. Just use python at least 2.6. This is definitely a case of premature optimization. And optimizing something stupid like file size.
1
209
0
0
2011-01-03T20:24:00.000
python,pyqt,python-2.3
PyQt & Python2.3
0
1
2
4,588,075
1
0
0
I am building a window application written in C++. I'd like to utilize several python libraries. I don't need any fancy Python interop here. My method is like this: Open a thread to run Python interpreter. Send commands from C++ to the Python interpreter. The C++ may need to write some intermediate files for the interop. This method is dirty, but it will work for a lot of interpreter-like environments, e.g. gnuplot, lua. My question is that what kind of API are there for me to use for this task. Maybe I need some Win32 API? EDIT: I don't need any Python specific. I really want the general method. So that my application could also work with gnuplot, etc..
false
4,596,013
0.099668
0
0
2
ActivePython (http://www.activestate.com/activepython/downloads) installs itself as an ActiveScript engine.The ProgID is Python.AXScript.2 . So you can use it with COM via the Windows standard IActiveScript interface. Read up on it. Distribution is another matter. Either you require that customers have it, or you could try and extract the juicy bits from the ActiveState's package, or maybe there's an official way to do unattended setup...
1
1,517
1
4
2011-01-04T16:38:00.000
c++,python,winapi,api
Embed a Python interpreter in a (Windows) C++ application
0
1
4
4,596,102
1
0
0
I am trying to display a simple graph using pydot. My question is that is there any way to display the graph without writing it to a file as currently I use write function to first draw and then have to use the Image module to show the files. However is there any way that the graph directly gets printed on the screen without being saved ?? Also as an update I would like to ask in this same question that I observe that while the image gets saved very quickly when I use the show command of the Image module it takes noticeable time for the image to be seen .... Also sometimes I get the error that the image could'nt be opened because it was either deleted or saved in unavailable location which is not correct as I am saving it at my Desktop..... Does anyone know what's happening and is there a faster way to get the image loaded..... Thanks a lot....
true
4,596,962
1.2
0
0
0
I'm afraid pydot uses graphviz to render the graphs. I.e., it runs the executable and loads the resulting image. Bottom line - no, you cannot avoid creating the file.
0
27,874
0
28
2011-01-04T18:19:00.000
python,pydot
Display graph without saving using pydot
0
1
7
4,597,838
1
0
0
I've created a little screensaver-type program with Python, and I'd like to get it working properly under gnome-screensaver. The documentation is all written for C, and there don't appear to be libraries for Python. Is there any way to get this working?
true
4,597,080
1.2
0
0
2
gnome-screensaver doesn't integrate with the screensavers any more than with a small config file that sets the name, some other properties, and a command to execute to start the screensaver. This is documented in the gnome-screensaver FAQ. The program that gets started needs to get the Window ID from the environment (XSCREENSAVER_WINDOW), and start displaying on that window. This is the tricky part, as it's not always obvious how to do that. Most toolkits should have methods to get a handle on an already existing window by giving the ID, so search your GUI-toolkit documentation for something like that.
0
567
0
2
2011-01-04T18:34:00.000
python,gnome,screensaver
Gnome-Screensaver with Python?
0
1
1
4,597,542
1
0
0
Is there any way to get what lines are currently visible in a Tkinter text widget? I'm trying to make a scrollbar. Currently I'm trying to coordinate my scroll bar with the other methods of scrolling (ie, the arrow keys and scroll wheel). So that when I scroll with the arrow keys or mouse, my bar scrolls too.
true
4,610,074
1.2
0
0
4
You can get the character (and thus, the line number) at a pixel position using an index of @x,y (eg: @0,0 for the top-left-most visible character). Since you know the width and height of the widget (using the winfo_width and winfo height methods) you can calculate what lines are at the bottom of the widget too. You can also use the yview method to get the relative portion of the text that is in view (eg: a value of .5 means you are half way through the document)
0
1,674
0
1
2011-01-05T22:59:00.000
python,tkinter
Visible lines in Tkinter text widget
0
1
3
4,611,229
1
0
0
i am trying below code still it is giving me horizontal line..i am missing something? self.ln = wx.StaticLine(self,-1,wx.Point(620,0), wx.Size(687,7),wx.LI_VERTICAL) self.ln.SetForegroundColour(wx.Colour(255,0,255))
false
4,623,031
0
0
0
0
thanks for ur reply got it now..i was missing style keyword ..earliar it has not given error thats why didnot found it self.ln = wx.StaticLine(self, -1, size=(4,479),style=wx.LI_VERTICAL)
0
6,448
0
4
2011-01-07T06:24:00.000
wxpython
How to draw vertical line using wxpython
0
1
2
4,623,890
1
0
0
Simply, I'm developing a wireless ECG (electrocardiogram, or EKG from the German Elektrokardiogramm) and I need to choose the best language for a desktop application that allows the following: wireless transmission of data over WiFi real-time graphing of ECG data signal a good DSP library Thanks.
false
4,623,047
0.197375
1
0
1
From the viewpoint of a normal program (i.e., not a device driver) a Wi-Fi connection is just a network connection -- not noticeably different from (for example) a wired Ethernet connection. Real-time graphing and digital signal processing libraries are probably a little less common, but not much. "Real time" is one of those slippery phrases that it's hard to pin down exactly what it means (different people use it differently). At a guess, you just mean you want to update the graph as data arrives. In that case, the important question is what bandwidth you're dealing with -- i.e., how many updates of how much information, how fast? Bottom line -- none of what you've told us gives much in the way of real criteria for picking a language to use. The obvious open question would be performance -- how much data you need to process, and how much processing you need to do on it. That might at least hint at one being better than another.
0
883
0
1
2011-01-07T06:26:00.000
c#,java,c++,python,c
ECG/EKG software language advice
0
1
1
4,623,129
1
0
0
i' have downloaded boost 1.45.0, installed Python 3.1.3 on my mac. I have the build Boost with Python succesfully. For this i had to edit my "project-config.jam" and add "using python : 3.1 : /Library/Frameworks/Python.framework/Versions/3.1;" into it. At this point all seems to be allright. Now when i try to use this lib in an xcode project, i have link errors: Undefined symbols: "boost::python::objects::make_nurse_and_patient(_object*, _object*)", referenced from: _object* boost::python::with_custodian_and_ward_postcall<0ul, 1ul, boost::python::default_call_policies>::postcall<_object*>(_object* const&, _object*)in libFluxCore.a(Python.o) "boost::python::objects::enum_base::enum_base(char const*, _object* ()(void const), void* (*)(_object*), void (*)(_object*, boost::python::converter::rvalue_from_python_stage1_data*), boost::python::type_info, char const*)", referenced from: sandbox::BindComponentState() in libFluxCore.a(Python.o) sandbox::BindCallOptions() in libFluxCore.a(Python.o) sandbox::BindFrameRate() in libFluxCore.a(Python.o) And lot of more... Paths and lib are well set in my project. Does someone have an idea of what can happen ? Thanks.
true
4,623,930
1.2
0
0
0
I'v finally found this error. buid boost python with ./bjam toolset=darwin-4.2 architecture=x86 address-model=32 link=static threading=multi runtime-link=static did the job, as i am on i86 arch.
1
380
0
0
2011-01-07T09:01:00.000
xcode,boost-python
Linker issue with boost python on Xcode
0
1
1
4,627,509
1
0
0
Is there a way to draw to ttkinter.Canvas like javascript or .NET canvas? I.E drawline() without storing an object for that line which can be manipulated later.
false
4,625,108
0.099668
0
0
1
I'm not sure what you mean by "storing an object". The canvas gives each thing you draw an id, but you don't have to store it. You can't prevent the canvas from assigning an id to the object but are free to completely ignore it. What problem are you trying to solve where you perceive this to be an issue? [edit] To clarify: yes, the interpreter keeps some sort of data for each thing that is drawn. It's not an object in the sense of a Python object though. It's more like a location in memory that describes the thing that was drawn.
0
248
0
1
2011-01-07T11:38:00.000
python,python-3.x,tkinter
Using tkinter.Canvas stateless-ly
0
1
2
4,625,172
1
0
1
i want to implement 1024x1024 monochromatic grid , i need read data from any cell and insert rectangles with various dimensions, i have tried to make list in list ( and use it like 2d array ), what i have found is that list of booleans is slower than list of integers.... i have tried 1d list, and it was slower than 2d one, numpy is slower about 10 times that standard python list, fastest way that i have found is PIL and monochromatic bitmap used with "load" method, but i want it to run a lot faster, so i have tried to compile it with shedskin, but unfortunately there is no pil support there, do you know any way of implementing such grid faster without rewriting it to c or c++ ?
false
4,637,190
0
0
0
0
One thing I might suggest is using Python's built-in array class (http://docs.python.org/library/array.html), with a type of 'B'. Coding will be simplest if you use one byte per pixel, but if you want to save memory, you can pack 8 to a byte, and access using your own bit manipulation.
0
651
0
3
2011-01-09T01:31:00.000
python,bitmap,performance
Python Fast monochromatic bitmap
0
2
3
4,637,207
1
0
1
i want to implement 1024x1024 monochromatic grid , i need read data from any cell and insert rectangles with various dimensions, i have tried to make list in list ( and use it like 2d array ), what i have found is that list of booleans is slower than list of integers.... i have tried 1d list, and it was slower than 2d one, numpy is slower about 10 times that standard python list, fastest way that i have found is PIL and monochromatic bitmap used with "load" method, but i want it to run a lot faster, so i have tried to compile it with shedskin, but unfortunately there is no pil support there, do you know any way of implementing such grid faster without rewriting it to c or c++ ?
false
4,637,190
0.132549
0
0
2
Raph's suggestin of using array is good, but it won't help on CPython, in fact I'd expect it to be 10-15% slower, however if you use it on PyPy (http://pypy.org/) I'd expect excellent results.
0
651
0
3
2011-01-09T01:31:00.000
python,bitmap,performance
Python Fast monochromatic bitmap
0
2
3
4,637,284
1
0
0
I am having problem with drawing in pydot. The problem lies in defining the layout of the nodes created. Currently everything is drawn vertically and is not spread. This gives me the problem of going down to see the nodes created. Is there any way I can define the nodes to be created horizontally whenever they are very large in number?? Also I want to display mathematical symbols in the labels. But I have not been able to find how to do that. If anyone knows please do tell how I can write epsilon and lambda in the labels from one node to another.... Thanks a lot...
true
4,638,806
1.2
0
0
0
I found out that writing the string in unicode representation shows mathematical symbols as edges... For example you can write node = pydot.Node("&#949;",shape = "ellipse", style="filled", fillcolor="turquoise") Using this we get epsilon as label of the node.... Similarly we can get rest of the mathematical symbols....
0
419
0
1
2011-01-09T11:07:00.000
python,pydot
changing layout and inserting mathematical symbols with pydot
0
1
1
4,844,143
1
0
0
I have a wxPython application that is almost done & I would like to place it in my portfolio. I have to consider when someone attempts to run my app that they may not have Python, or wxPython, so if they just click the main script/python file its not going to run, right? How should I distribute my app (how do you distribute ur apps) so that it can be run & also so that it could be run on the 3 major OS's (Unix, Windows, MacOSX)? I know of py2exe for releasing under windows, but what can I use for Unix & MacOSX to compile the program? Whats the easiest way?
false
4,643,247
0.066568
0
0
1
I suggest both, script for all platforms and frozen binary for lazy windows users. To answer your latest question, you don't compile python. Python is an interpreted language, it gets compiled on the fly when run. A python frozen binary is actually the python interpreter with your script hardcoded in it. And frozen binaries are windows-only, AFAIK. Besides, Unix and MacOS (usually) come with python pre-installed.
0
1,685
1
3
2011-01-10T02:33:00.000
python,wxpython
Releasing a wxPython App: Give out scripts or compile in Exe, etc?
0
1
3
4,643,279
1
0
0
My cocoa app runs background tasks, which I would like to stop when the user becomes idle (no keyboard/mouse input) and then resume when the user becomes active again. Is there a way to register for idle-state notifications?
false
4,643,579
0.049958
0
0
1
I used a different approach. Subclassing UIApplication I override the sendEvent method filtering touches (actually you can filter any kind of event, acceleration, touches, etc.). Using a shared variable and a background timer I managed the "idle". Every time the user touch the screen the variable is set with current timeInterval (current time). The timer fire method checks for the elapsed time since last touch, if greater than the threshold (in my case was around 90seconds) you can POST your own notification. I used this simple approach to create a custom set of apps that after some idle time automatically call the "screensaver" app. Nothing clever, it just do the job. Hope that helps.
0
3,011
0
7
2011-01-10T03:59:00.000
objective-c,time,python-idle
Objective C: Get notifications about a user's idle state
0
1
4
9,402,960
1
0
0
is it possible to convert a Python program to C/C++? I need to implement a couple of algorithms, and I'm not sure if the performance gap is big enough to justify all the pain I'd go through when doing it in C/C++ (which I'm not good at). I thought about writing one simple algorithm and benchmark it against such a converted solution. If that alone is significantly faster than the Python version, then I'll have no other choice than doing it in C/C++.
false
4,650,243
1
1
0
163
If the C variant needs x hours less, then I'd invest that time in letting the algorithms run longer/again "invest" isn't the right word here. Build a working implementation in Python. You'll finish this long before you'd finish a C version. Measure performance with the Python profiler. Fix any problems you find. Change data structures and algorithms as necessary to really do this properly. You'll finish this long before you finish the first version in C. If it's still too slow, manually translate the well-designed and carefully constructed Python into C. Because of the way hindsight works, doing the second version from existing Python (with existing unit tests, and with existing profiling data) will still be faster than trying to do the C code from scratch. This quote is important. Thompson's Rule for First-Time Telescope Makers It is faster to make a four-inch mirror and then a six-inch mirror than to make a six-inch mirror. Bill McKeenan Wang Institute
0
475,467
0
202
2011-01-10T18:46:00.000
c++,python,c,code-generation
Convert Python program to C/C++ code?
0
2
8
4,650,953
1
0
0
is it possible to convert a Python program to C/C++? I need to implement a couple of algorithms, and I'm not sure if the performance gap is big enough to justify all the pain I'd go through when doing it in C/C++ (which I'm not good at). I thought about writing one simple algorithm and benchmark it against such a converted solution. If that alone is significantly faster than the Python version, then I'll have no other choice than doing it in C/C++.
false
4,650,243
1
1
0
12
I know this is an older thread but I wanted to give what I think to be helpful information. I personally use PyPy which is really easy to install using pip. I interchangeably use Python/PyPy interpreter, you don't need to change your code at all and I've found it to be roughly 40x faster than the standard python interpreter (Either Python 2x or 3x). I use pyCharm Community Edition to manage my code and I love it. I like writing code in python as I think it lets you focus more on the task than the language, which is a huge plus for me. And if you need it to be even faster, you can always compile to a binary for Windows, Linux, or Mac (not straight forward but possible with other tools). From my experience, I get about 3.5x speedup over PyPy when compiling, meaning 140x faster than python. PyPy is available for Python 3x and 2x code and again if you use an IDE like PyCharm you can interchange between say PyPy, Cython, and Python very easily (takes a little of initial learning and setup though). Some people may argue with me on this one, but I find PyPy to be faster than Cython. But they're both great choices though. Edit: I'd like to make another quick note about compiling: when you compile, the resulting binary is much bigger than your python script as it builds all dependencies into it, etc. But then you get a few distinct benefits: speed!, now the app will work on any machine (depending on which OS you compiled for, if not all. lol) without Python or libraries, it also obfuscates your code and is technically 'production' ready (to a degree). Some compilers also generate C code, which I haven't really looked at or seen if it's useful or just gibberish. Good luck. Hope that helps.
0
475,467
0
202
2011-01-10T18:46:00.000
c++,python,c,code-generation
Convert Python program to C/C++ code?
0
2
8
37,192,125
1
1
0
I am working on a project that is based on Urdu language in Ubuntu platform. I'm using Python language and have almost achieved my task. The problem is that, the Urdu text is rendered in reverse order. For example, consider the word کام (which means work) consisting of the three letters: ک , ا , and م The output is rendered in reverse order as ماک consisting of the three letters: م, ا, and ک When copying this text to Open Office or opening the generated XML file in Firefox, the generated result is absolutely desired. I Am using Python 2.6 IDLE, its working perfect with Windows platform, which clearly shows its not the problem of IDLE. Am working on TKINTER GUI library. How can this problem be solved?
false
4,668,985
-0.099668
0
0
-1
Use a toolkit that isn't terrible, such as PyQt, PyGTK, or wxPython.
1
824
0
2
2011-01-12T12:50:00.000
python,linux,fonts,tkinter,right-to-left
Reverse rendering of Urdu fonts
0
1
2
4,669,402
1
0
0
I'm trying to use clr.AddReference to add sqlite3 functionality to a simple IronPython program I'm writing; but everytime I try to reference System.Data.SQLite I get this error: Traceback (most recent call last): File "", line 1, in IOError: System.IO.IOException: Could not add reference to assembly System.Data.SQLite at Microsoft.Scripting.Actions.Calls.MethodCandidate.Caller.Call(Object[] args, Boolean&shouldOptimize) at IronPython.Runtime.Types.BuiltinFunction.BuiltinFunctionCaller2.Call1(CallSite site, CodeContext context, TFuncType func, T0 arg0) at System.Dynamic.UpdateDelegates.UpdateAndExecute3[T0,T1,T2,TRet](CallSite site, T0 arg0, T1 arg1, T2 arg2) at CallSite.Target(Closure , CallSite , CodeContext , Object , Object ) at IronPython.Compiler.Ast.CallExpression.Invoke1Instruction.Run(InterpretedFrame frame) at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame) at Microsoft.Scripting.Interpreter.LightLambda.Run2[T0,T1,TRet](T0 arg0, T1 arg1) at IronPython.Runtime.FunctionCode.Call(CodeContext context) at IronPython.Runtime.Operations.PythonOps.QualifiedExec(CodeContext context, Object code, PythonDictionary globals, Object locals) at Microsoft.Scripting.Interpreter.ActionCallInstruction4.Run(InterpretedFrame frame) at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame) I've been testing out the imports and references in the interpreter mainly, and these are the lines I test: import sys import clr sys.path.append("C:/Program Files (x86)/SQLite.NET/bin") clr.AddReference("System.Data.SQLite") The error happens after the clr.AddReference line is entered. How would I add System.Data.SQLite properly?
false
4,682,960
0.197375
0
1
1
My first guess is that you're trying to load the x86 (32-bit) System.Data.SQLite.dll in a x64 (64-bit) process, or vice versa. System.Data.SQLite.dll contains the native sqlite3 library, which must be compiled for x86 or x64, so there is a version of System.Data.SQLite.dll for each CPU. If you're using the console, ipy.exe is always 32-bit (even on 64-bit platforms) while ipy64.exe is AnyCPU, so it matches the current platform. If you're hosting IronPython, and the host app is AnyCPU, you need to load the right copy of System.Data.SQLite.dll for the machine you're running on (or just force the host app x86).
0
1,695
0
1
2011-01-13T17:11:00.000
ado.net,ironpython,system.data.sqlite
Adding System.Data.SQLite reference in IronPython
0
1
1
4,696,478
1
0
0
I'm having a database (sqlite) of members of an organisation (less then 200 people). Now I'm trying to write an wx app that will search the database and return some contact information in a wx.grid. The app will have 2 TextCtrls, one for the first name and one for the last name. What I want to do here is make it possible to only write one or a few letters in the textctrls and that will start to return result. So, if I search "John Smith" I write "Jo" in the first TextCtrl and that will return every single John (or any one else having a name starting with those letters). It will not have an "search"-button, instead it will start searching whenever I press a key. One way to solve this would be to search the database with like " SELECT * FROM contactlistview WHERE forname LIKE 'Jo%' " But that seems like a bad idea (very database heavy to do that for every keystroke?). Instead i thought of use fetchall() on a query like this " SELECT * FROM contactlistview " and then, for every keystroke, search the list of tuples that the query have returned. And that is my problem: Searching a list is not that difficult but how can I search a list of tuples with wildcards?
false
4,698,933
0
0
0
0
If you are searching for a string matching the start using LIKE, eg 'abc%' (rather than anywhere in the string - '%abc%'), the search should be quite fast if you have an index on the field, as the db can use the index to help find the matches.
0
697
0
0
2011-01-15T09:49:00.000
python,sqlite,tuples
Searching a list of tuples in python
0
2
3
4,699,909
1
0
0
I'm having a database (sqlite) of members of an organisation (less then 200 people). Now I'm trying to write an wx app that will search the database and return some contact information in a wx.grid. The app will have 2 TextCtrls, one for the first name and one for the last name. What I want to do here is make it possible to only write one or a few letters in the textctrls and that will start to return result. So, if I search "John Smith" I write "Jo" in the first TextCtrl and that will return every single John (or any one else having a name starting with those letters). It will not have an "search"-button, instead it will start searching whenever I press a key. One way to solve this would be to search the database with like " SELECT * FROM contactlistview WHERE forname LIKE 'Jo%' " But that seems like a bad idea (very database heavy to do that for every keystroke?). Instead i thought of use fetchall() on a query like this " SELECT * FROM contactlistview " and then, for every keystroke, search the list of tuples that the query have returned. And that is my problem: Searching a list is not that difficult but how can I search a list of tuples with wildcards?
false
4,698,933
0.132549
0
0
2
I think that generally, you shouldn't be afraid of giving tasks to a database. It's quite possible that the LIKE clause will be very fast. Sqlite is implemented in fairly robust C code, and will happily deal with queries like this. If you're worried about sending too many requests, why not send a query once a user has entered a threshold of characters, such as three? A list comprehension is probably the best way to return the result if you want to do added filtering.
0
697
0
0
2011-01-15T09:49:00.000
python,sqlite,tuples
Searching a list of tuples in python
0
2
3
4,698,981
1
0
0
If I have a Python package that depends on some C libraries (like say the Gnu Scientific Library (GSL) for numerical computations), is it a good idea to bundle the library with my code? I'd like to make my package as easy to install as possible for users and I don't want them to have to download C libraries by hand and supply include-paths. Also I could always ensure that the version of the library that I ship is compatible with my code. However, is it possible that there are clashes if the user has the library installed already, or ar there any other reasons why I shouldn't do this? I know that I can make it easier for users by just providing a binary distribution, but I'd like to avoid having to maintain binary distributions for all possible OSs. So, I'd like to stick to a source distribution, but for the user (who proudly owns a C compiler) installation should be as easy as python setup.py install.
false
4,700,178
0
0
0
0
You could have two separate branches of the src, one containing the libraries and another that doesn't. That way you can explicitly warn your users in case they have installed the libraries. Another solution could be (if the licences of the libraries allow you) is to wrap 'em up in a single file. I think there's no unique solution, but this are the ideas I could think so far. Good luck
1
629
0
7
2011-01-15T14:47:00.000
python,c,distutils
Should I bundle C libraries with my Python application?
0
1
3
4,700,264
1
0
0
I am thinking about to learn new language or framework. Now I deal with C# and WPF, WCF, Winforms. I have some free time so I would like get new skills. But I have dilema, start with some C++ framework (such as Platinum, Reason, Evocosm, ACF) or try Python / python framework. I you are on my place which possibility you choose? I am 17 years student, I have basic skills in C++ (OOP, little with STL), with Python I haven’t any experience. What would be your choice and why?
true
4,708,482
1.2
1
0
0
Personally I prefer Python, but profesionally, that is if you want a good job C++ is a better choice.
1
438
0
3
2011-01-16T22:20:00.000
c++,python,frameworks
Start with some C++ framework or python
0
4
6
4,708,502
1
0
0
I am thinking about to learn new language or framework. Now I deal with C# and WPF, WCF, Winforms. I have some free time so I would like get new skills. But I have dilema, start with some C++ framework (such as Platinum, Reason, Evocosm, ACF) or try Python / python framework. I you are on my place which possibility you choose? I am 17 years student, I have basic skills in C++ (OOP, little with STL), with Python I haven’t any experience. What would be your choice and why?
false
4,708,482
0.033321
1
0
1
I recommend you to keep learning C++. Before you started looking for framework learn some popular search algorithm and try implement them. After that try implement some structures, like queues, list, stack, binary trees and some operation on them. Meanwhile play with I/O (for example, try write your stack to file and read it back to stack - in plain text and binary). It was my university tour on programming class. C++ is good choice because it is hard and multiparadigmats language so in future u will find much in common with other languages and you will be familiar with memory management system.
1
438
0
3
2011-01-16T22:20:00.000
c++,python,frameworks
Start with some C++ framework or python
0
4
6
4,708,519
1
0
0
I am thinking about to learn new language or framework. Now I deal with C# and WPF, WCF, Winforms. I have some free time so I would like get new skills. But I have dilema, start with some C++ framework (such as Platinum, Reason, Evocosm, ACF) or try Python / python framework. I you are on my place which possibility you choose? I am 17 years student, I have basic skills in C++ (OOP, little with STL), with Python I haven’t any experience. What would be your choice and why?
false
4,708,482
0
1
0
0
Well. Learning Python basics will take a week, and you will save the time spent in a year since it is such a good language for small hacks and scripts. So I suggest you learn it first. Learning C++ well will take you five to ten years, so there is not the same immediate benefit :)
1
438
0
3
2011-01-16T22:20:00.000
c++,python,frameworks
Start with some C++ framework or python
0
4
6
4,708,899
1
0
0
I am thinking about to learn new language or framework. Now I deal with C# and WPF, WCF, Winforms. I have some free time so I would like get new skills. But I have dilema, start with some C++ framework (such as Platinum, Reason, Evocosm, ACF) or try Python / python framework. I you are on my place which possibility you choose? I am 17 years student, I have basic skills in C++ (OOP, little with STL), with Python I haven’t any experience. What would be your choice and why?
false
4,708,482
0
1
0
0
I'd pick C++ for the sole reason that it's nothing like the languages you already know, even though it shares some syntax.
1
438
0
3
2011-01-16T22:20:00.000
c++,python,frameworks
Start with some C++ framework or python
0
4
6
4,708,606
1
0
0
I have a main window and I want that when I maximize it the widgets inside it should automatically be resized .... Is there any way I can do that ????
true
4,712,705
1.2
0
0
2
Yes. Use layout objects (such as QHBoxLayout or QGridLayout) to organize your widgets inside, and set the widgets' resize modes accordingly. Note that standard Qt-supplied widgets support resizing by default.
0
1,134
0
1
2011-01-17T11:39:00.000
python,pyqt4
PyQt4 - Maximize window along with inside widgets
0
2
2
4,712,851
1
0
0
I have a main window and I want that when I maximize it the widgets inside it should automatically be resized .... Is there any way I can do that ????
false
4,712,705
0.099668
0
0
1
If you want to save you a lot of work, don't hand-code the ui. Use Qt Creator to create a ui file and then load this file dynamically using PyQt4.uic module. There is also a "static" approach that generates python code from Qt Creator ui files.
0
1,134
0
1
2011-01-17T11:39:00.000
python,pyqt4
PyQt4 - Maximize window along with inside widgets
0
2
2
4,713,335
1
0
0
I'm trying to create a menu bar in wxPython 2.8.11.0 and Python 2.7 where most of the menus are left aligned (as normal) but one is - ideally - right aligned, or at least separated in some way from the rest. Is this possible? EDIT: This needs to be a cross-platform solution.
false
4,730,785
0.197375
0
0
1
If the native menubar doesn't support it, then wxPython probably won't either. There is a pure Python implementation of the menubar though. It's called FlatMenu. I would try that. If it doesn't work, at least you can hack it or submit a patch in Python code rather than trying to figure out the C++ for fixing wxWidgets.
0
608
0
2
2011-01-19T01:08:00.000
python,menu,cross-platform,wxpython,menubar
Is it possible to align a menu to the right of the menu bar using wxPython?
0
1
1
4,763,966
1
0
0
I am working on Qtdesigner for generating a GUI for my python app. The problem is that I had manually made the widgets and then compiled it to py. But then I found out that the components did not resize when maximised. So I opened the .ui file in designer and selected the group box for my widgets and chose layout in grid by right clicking on it. Even now the widgets do not resize on maximising.... Do I have to do something else ??? Thanks a lot...
true
4,737,324
1.2
0
0
0
To have the widgets resized with the window, you must apply a layout to your top-level object (usually QMainWindow), and then place your new widgets where you want in the layout (and maybe other layouts for a more complicated window). NOTE: the menu items allowing to apply a layout on the main window will be available only once you have placed your first widget in it.
0
316
0
0
2011-01-19T15:47:00.000
python,qt,pyqt4,qt-designer
Help in designing layout with qtdesigner for python
0
1
1
4,741,509
1
0
0
HI, guys, I am using wxpython to develop a GUI for software configuration, launching and interaction. I want something like a CLI shell window (like pycrust) embedded inside the GUI to interact with a long-term running background process. I could give the input via this shell window and print the output on this window. My current code works very well. But there is problem of editing style, because wx.TextCtrl is simply an editable text window. e.g., I could overwrite or remove any previous text characters or type new input at any location. This is not desirable. How can I make the wx.TextCtrl like a shell window, i.e. make the output readonly, while keep input editable? e.g., 1) when input new command, the position only starts after prompt. 2) The user cannot change or replace any previous output text. I want to force certain restriction, for interaction purpose. Is there a way to fix the curse prompt? If so, then my problem will be solved, because the user will have no chance to move the curse. Or is there a way to set certain part of the text (the output and the prompt) readonly? Or another solution, thanks to 9000's answer, is that I make a grid of windows (a StaticTextCtrl or readonly TextCtrl for output in the upper window; prompt ">>>" on the bottom left area; invisible-border editable window or entry dialog on the bottom right area for input). any suggestions? Is there any better choice? Thanks a lot!
false
4,747,944
0.066568
0
0
1
In our product we have a console made up of two edit windows, separated by a thin line. The upper window is the output window, it is read-only. The lower window is editable. Once you have written a command in it and submitted it, the command is removed from the lower window and goes to the upper window, along with command's output. You can click the upper window, select something from it, scroll it up, etc, all without removing the command you're currently editing from sight. Then you click on the lower window or press any key, and the control returns to the lower window, where you continue to craft your next command.
0
1,237
0
1
2011-01-20T13:53:00.000
shell,formatting,input,wxpython,wxwidgets
output readonly, input editable with wx.textctrl?
0
2
3
4,748,126
1
0
0
HI, guys, I am using wxpython to develop a GUI for software configuration, launching and interaction. I want something like a CLI shell window (like pycrust) embedded inside the GUI to interact with a long-term running background process. I could give the input via this shell window and print the output on this window. My current code works very well. But there is problem of editing style, because wx.TextCtrl is simply an editable text window. e.g., I could overwrite or remove any previous text characters or type new input at any location. This is not desirable. How can I make the wx.TextCtrl like a shell window, i.e. make the output readonly, while keep input editable? e.g., 1) when input new command, the position only starts after prompt. 2) The user cannot change or replace any previous output text. I want to force certain restriction, for interaction purpose. Is there a way to fix the curse prompt? If so, then my problem will be solved, because the user will have no chance to move the curse. Or is there a way to set certain part of the text (the output and the prompt) readonly? Or another solution, thanks to 9000's answer, is that I make a grid of windows (a StaticTextCtrl or readonly TextCtrl for output in the upper window; prompt ">>>" on the bottom left area; invisible-border editable window or entry dialog on the bottom right area for input). any suggestions? Is there any better choice? Thanks a lot!
false
4,747,944
0.066568
0
0
1
Just keep track of the location of the prompt each time you display it. Intercept all keypresses and releases, and if anything causes text before the prompt to change, veto that event. It's not that hard, it just takes a little attention to detail and some diligence to capture all text-modification events.
0
1,237
0
1
2011-01-20T13:53:00.000
shell,formatting,input,wxpython,wxwidgets
output readonly, input editable with wx.textctrl?
0
2
3
4,764,075
1
0
0
We are building an app where in there will be a need to display the updates/notification (ex : like status updates/wall posts on FB). These needs to be displyed at the lower right corner of the window(like any other notifications). So was trying on some alternatives to best display the updates. Some option explored are PopupWindow (which was not that great for status update) and dialog (seems ok). Are there any other good options for this and is there any pre-defined end corners position constants? Plz suggest.
false
4,755,963
0
0
0
0
I second the ToasterBox suggestion. You can also create your own Dialog though and position it by grabbing the screen resolution and the size of the dialog and setting its position. I've done the latter for a custom popup. On Macs, you can access Growl through a Python API that's mentioned on their website.
0
2,743
0
4
2011-01-21T06:16:00.000
python,user-interface,wxpython
wxPython PopUp notifications
0
1
3
4,763,861
1
0
0
Considering the following requirementes: Must be supported on Windows. Preferably works also on other platforms. Must support multi threading. By that I mean that the engine can work in parallel in multiple threads. Readability is important. License must be compatible with closed-source projects. I like Python for its readablity. I am also have more experience with Python than other scripting languages. However CPython is not multi-threaded, and IronPython requires hosting the CLR and a compatible language (C++/CLI or C#).
false
4,756,544
0.016665
0
0
1
Im pretty sure Stackless Python is going to be the only one supporting multithreading out the box. Stackless Python was chosen by CCP for their MMO: Eve-Online specifically because the stackless nature of the code allowed them to schedule the continuations on any OS thread they needed once they'd built the necessary primitives in to make the whole thing thread safe. Lua can be used in a multi threaded environment, but each concurrent thread would need a separate lua_State object so you'd need to build your own interthread message passing system for lua code, executing in the context of separate lua states, to communicate.
1
4,208
0
17
2011-01-21T07:51:00.000
javascript,python,ruby,windows,lua
Which scripting language is better for embedding in multi-threaded C/C++ application
0
5
12
4,774,036
1
0
0
Considering the following requirementes: Must be supported on Windows. Preferably works also on other platforms. Must support multi threading. By that I mean that the engine can work in parallel in multiple threads. Readability is important. License must be compatible with closed-source projects. I like Python for its readablity. I am also have more experience with Python than other scripting languages. However CPython is not multi-threaded, and IronPython requires hosting the CLR and a compatible language (C++/CLI or C#).
false
4,756,544
0
0
0
0
Entirely preference-based. Most languages have a way to embed in C with options for exports into the scripting environment. If it were me, I'd go with V8 Javascript.
1
4,208
0
17
2011-01-21T07:51:00.000
javascript,python,ruby,windows,lua
Which scripting language is better for embedding in multi-threaded C/C++ application
0
5
12
4,855,161
1
0
0
Considering the following requirementes: Must be supported on Windows. Preferably works also on other platforms. Must support multi threading. By that I mean that the engine can work in parallel in multiple threads. Readability is important. License must be compatible with closed-source projects. I like Python for its readablity. I am also have more experience with Python than other scripting languages. However CPython is not multi-threaded, and IronPython requires hosting the CLR and a compatible language (C++/CLI or C#).
false
4,756,544
0
0
0
0
By "multithreaded" I'm assuming you mean "can effectively exploit multiple cores"? If your system only has a single CPU, then you're only going to be done one thing at a time regardless of the scripting language you choose. If you do decide to go the CPython route, then there the main thing to remember is that it is only the scripting engine itself that is protected by the global interpreter lock. If the script being executed spends a lot of time calling out to non-Python code (including I/O and other system level operations) then it can exploit multiple threads quite happily. Another factor to consider is that Python's introspection capabilities make it inherently difficult to secure properly (Google have done it for AppEngine, but they had to disallow quite a few things in the process). Given the prevalence of Javascript engines in browsers and Lua engines in PC games, one of those is likely to be an easier way forward.
1
4,208
0
17
2011-01-21T07:51:00.000
javascript,python,ruby,windows,lua
Which scripting language is better for embedding in multi-threaded C/C++ application
0
5
12
4,859,076
1
0
0
Considering the following requirementes: Must be supported on Windows. Preferably works also on other platforms. Must support multi threading. By that I mean that the engine can work in parallel in multiple threads. Readability is important. License must be compatible with closed-source projects. I like Python for its readablity. I am also have more experience with Python than other scripting languages. However CPython is not multi-threaded, and IronPython requires hosting the CLR and a compatible language (C++/CLI or C#).
false
4,756,544
1
0
0
11
I've been in the same dilemma an choose Lua over Python and JScript. The thing which Lua does best is the great interop with C/C++ code using libraries like luabridge and luabind. That is, you can call lua from C++ and have the script call back into C++ without a problem, access c++ data from the script and vice versa. The problem with languages like Python and Lua is that the language is not really multi-threaded in the regular sense of the word: if one C++ thread it using the language scripting engine to run a script, you cannot use the same engine to run another script. Both languages has an engine-wide lock which can be used in those cases to make sure the engine integrity is maintained. However, both languages are multi-threaded in the sense that you can run function in the background and interact with any synchronization object you want (just like from C++). So I choose to have all threads created from C++ and scripting code only run in a dedicated threads (thread per engine) and interact with other threads in the application in the regular ways. If you need to pass data and control from C++ to a script and vice versa, Lua is much better than Python. Beside that, I would not host the CLR in a C++ project. It's too messy.
1
4,208
0
17
2011-01-21T07:51:00.000
javascript,python,ruby,windows,lua
Which scripting language is better for embedding in multi-threaded C/C++ application
0
5
12
4,769,506
1
0
0
Considering the following requirementes: Must be supported on Windows. Preferably works also on other platforms. Must support multi threading. By that I mean that the engine can work in parallel in multiple threads. Readability is important. License must be compatible with closed-source projects. I like Python for its readablity. I am also have more experience with Python than other scripting languages. However CPython is not multi-threaded, and IronPython requires hosting the CLR and a compatible language (C++/CLI or C#).
false
4,756,544
1
0
0
12
Lua is the best choice. Python, Ruby and JavaScript are big languages and they are not designed for to embed. But Lua is different, designed to embed. You should consider the "restriction" more than any other things for your script language. Embed scripts can use for hack (bad meaning) easily. For example, by default Lua can not print to console. As I know, Blizzard uses the Lua because of that.
1
4,208
0
17
2011-01-21T07:51:00.000
javascript,python,ruby,windows,lua
Which scripting language is better for embedding in multi-threaded C/C++ application
0
5
12
4,808,596
1
0
0
I want to draw a Grid World (similar to a table), where cells may contain robots or obstacles. A dot/arrow would do to represent the robot and colouring the cells in black for examples could represent the obstacles. I am not looking for anything complicated, just a simple python library that would help me do this. Any suggestions?
true
4,783,462
1.2
0
0
1
tkinter has a canvas widget that is pretty easy to work with. It has primitives for lines and filled polygons and circles and so on. And with the event loop its pretty easy to do simple animations.
1
3,612
0
3
2011-01-24T14:59:00.000
python,grid,draw
How to draw Grid World using Python
0
1
1
4,784,164
1
0
0
I have made an application using Python and recently i found that i can use py2exe to make executables for windows. The problem is that a library i am using (xmpppy) produces this error DeprecationWarning: the md5 module is deprecated; use hashlib instead and when i try to run the executable a dialog appears saying this See the logfile 'C:\Python26\P2E\MyApp\dist\MyApp.exe.log' for details any ideas how to fix that?
false
4,793,250
-0.197375
0
0
-2
when a python script .py has any error it shows in console but when you run python .exe file it genrates .exe.log file when error accured.so go to your folder and see that there is a .exe.log file is there showing errors.
1
974
0
0
2011-01-25T12:03:00.000
python,pyqt4,xmpppy
PyQt4 - "See the log file for details" error
0
1
2
50,261,727
1
0
0
I am trying to build my first wx application I have a browse button in my panel, the user adds his file. i do some processing on the file. Now i want to show the information in a TextCtrl so that the user may modify it. Then i need to write it in a file. But I dont know how many TextCtrl box is needed before processing the file. Using the browse button event i have got the file, extracted the information also. But i dont know how to show the information back to the user. any suggestion is appreciated.
false
4,802,134
0
0
0
0
If all you're doing is showing one file, then all you need is one TextCtrl. I would give the widget the wx.TE_MULTILINE style and add it to a sizer with an EXPAND flag: sizer.Add(myTxtCtrl, 0, wx.EXPAND) Then the user can see the file and you can save the data with a Save button or menu item. The handler for that would basically just grab the text control's contents using it's GetValue() method.
0
439
0
0
2011-01-26T07:10:00.000
wxpython,textctrl
wxPython: TextCtrl problem
0
1
1
4,807,514
1
0
0
I'm using python 3 / tkinter if that matters. In looking at code samples I noticed that the main loop is typically in the GUI part of the code, and the rest of the code provides callbacks for GUI to call when needed. But my simulation runs independently of the user interaction; the UI is there to provide a view, from time to time, into what's going on in the simulation, but it doesn't control what goes on in the simulation. So I would like the main loop to be concerned with the simulation rather than UI. How would I do that?
false
4,812,323
0.066568
0
0
1
Write your own main loop that calls the functions that check for and process GUI events.
0
816
0
2
2011-01-27T03:02:00.000
python,design-patterns,user-interface,tkinter
Can the main loop of a program be moved out of GUI?
0
2
3
4,812,333
1
0
0
I'm using python 3 / tkinter if that matters. In looking at code samples I noticed that the main loop is typically in the GUI part of the code, and the rest of the code provides callbacks for GUI to call when needed. But my simulation runs independently of the user interaction; the UI is there to provide a view, from time to time, into what's going on in the simulation, but it doesn't control what goes on in the simulation. So I would like the main loop to be concerned with the simulation rather than UI. How would I do that?
true
4,812,323
1.2
0
0
2
Why not seperate your logic and presentation. Write your sim backend to respond to a single text based protcol to receive cmds and send back results, and then just talk to it from your gui program over e.g. unix sockets.
0
816
0
2
2011-01-27T03:02:00.000
python,design-patterns,user-interface,tkinter
Can the main loop of a program be moved out of GUI?
0
2
3
4,812,403
1
0
0
I'm using the pyBluez module on Python 2.6 on WindowsXP. I'd like to get the RSSI of other bluetooth devices around. I foudn some code but it makes use of _bluetooth, which I cannto find anywhere for Windows. Is it available / is there another way to circumvent the problem, getting the RSSI without using _bluetooth? Thank you all!
false
4,815,088
0
1
0
0
The _bluetooth module is a part of PyBluez. If you have installed a Windows release of PyBluez, it should work. I don't know enough about Bluetooth to even know what "getting the RSSI without using it" means or why it should be a problem, so can't help you there. :)
0
1,917
0
1
2011-01-27T10:17:00.000
python,windows,bluetooth,rssi
RSSI with pyBluez on WindowsXP
0
1
3
4,815,494
1
0
0
I am currently taking a course on Compilers. I don't like the idea of blindly memorising facts without any sort of place to apply them to. I want to learn by hands-on doing. So, I would like to have the complete code of 3-4 compilers, possibly for languages with different syntax rules (python,c, c++, java) while working through the Dragon book. If complete compilers are too much of an ask, examples of parsers(well-written LL, LR, LALR parsers) and intermediate-code generators for these languages would also do. There is a LOT of code out there on the Internet regarding this, but I want something that is considered to be high-quality and standard. I would be grateful for any resources that you can refer me to in this matter. Thanks.
false
4,818,779
0.066568
0
0
2
You can grab code for the Lua compiler from lua.org, they distribute full source, and you could also get GCC's source code, which is both C and C++ compiling.
1
1,318
0
1
2011-01-27T16:11:00.000
java,c++,python,parsing,compiler-construction
Good source code for compiler components
0
2
6
4,818,927
1
0
0
I am currently taking a course on Compilers. I don't like the idea of blindly memorising facts without any sort of place to apply them to. I want to learn by hands-on doing. So, I would like to have the complete code of 3-4 compilers, possibly for languages with different syntax rules (python,c, c++, java) while working through the Dragon book. If complete compilers are too much of an ask, examples of parsers(well-written LL, LR, LALR parsers) and intermediate-code generators for these languages would also do. There is a LOT of code out there on the Internet regarding this, but I want something that is considered to be high-quality and standard. I would be grateful for any resources that you can refer me to in this matter. Thanks.
false
4,818,779
0
0
0
0
Your course on compilers should be giving you the pieces that will eventually lead to a full blown compiler. For example, the section on lexical analysis can lead to a component called the Lexer. If you keep an eye open to generics and re-usability, you can turn this into a component that can be used later in your compiler. I highly suggest you take the approach of having at least two components in every homework project: main and the library component. In the example of lexical analysis, the main component would handle input and testing. The library component would be the lexer. This technique will help greatly after you graduate and develop huge applications in the real world.
1
1,318
0
1
2011-01-27T16:11:00.000
java,c++,python,parsing,compiler-construction
Good source code for compiler components
0
2
6
4,820,418
1
0
0
I am trying to create a small application for Symbian mobile phones using Python. Being a beginner i am having some trouble in setting up the environment for development. I installed Symbian3 SDK,PyS60 Application Manager ( for creating the .sis files to be installed on phones) and python 2.5.2 . I created a small hello world program and created its equivalent .sis file. But when i try to install it in Symbian 3 SDK, it gives me a 'Python Run time Error' ; i suppose it is because there isnt any python installed on the SDK. But when i tried to install the PythonForS60.sis file, it gives me a certificate error. I tried downloading the file through SDK, again it gives me a certificate error. I tried certifying the application through SymbianSigned.com, then it gives this error "The .sis file contains capabilities that are not permitted for Open Signed (Online) FAILURE: Submitted .sis file uses a UID that is not allocated to the account holder matching this email address (0x20022ee8 ) FAILURE: Submitted .sis file uses a UID that is in protected range and is not allocated to the account holder matching this email address (0x20022ee8)" . Can somebody help me to solve this..??
true
4,825,055
1.2
1
0
1
Open Application Manager on your Symbian phone, go to settings and select Software installation. Change it from Signed to All. This will allow you to install applications which don't have a certificate, such as the SIS file you just packaged. Also note that PythonForS60 2.0 works only with Python 2.5.
0
900
0
1
2011-01-28T05:11:00.000
python,symbian,pys60
Certificate Error on installing PythonForS60
0
1
1
4,825,096
1
0
0
I am trying to optimize the interaction between two scripts I have. Two things I thought of are the c++ program not terminating unless you manually kill it, or generating all info in python before feeding it to c++. Explanation of the problem: What the scripts do: C++ program (not made by me, and I can't program in c++ very well): takes a 7 number array and returns a single number, simple. Python script (mine, and I can program a bit in python): generates those 7 number arrays, feeds them to the c++ program, waits for an answer and adds it to a list. It then makes the next array. In theory, this works. However, as it is right now, it opens and closes the c++ program for each call. For one array that is no problem, but I'm trying to upscale to 25k arrays, and in the future to 6+ million arrays. Obviously it is then no longer feasible to open/close it each time, especially since the c++ program first has to load a 130mb VCD file to function. Two options I thought of myself were to generate all arrays first in python, then feed them to the c++ program and then analyze all results. However, I wouldn't know how to do this with 6M arrays. It is not important however that the results I get back are in the same order as the arrays I feed in. Second option I thought of was to make the c++ program not quit after each call. I can't program in c++ though so I don't know if this is possible, keeping it 'alive' so you can just feed arrays into it at times and get an answer. (Note: I cannot program in anything else than python, and want to do this project in python. The c++ program cannot be translated to python for speed reasons.) Thanks in advance, Max.
false
4,826,896
0.039979
1
0
1
Firstly, just to be pedantic, there are no C++ scripts in normal use. C++ compiles, ultimately, to machine code, and the C++ program is properly referred to as a "program" and not a "script". But to answer your question, you could indeed set up the C++ program to stay in memory, where it listens for connections and sends responses to your Python script. You'd want to study Unix IPC, particularly sockets. Another way to approach it would be to incorporate what the C++ program does into your Python script, and forget about C++ altogether.
0
2,200
0
1
2011-01-28T09:59:00.000
c++,python,optimization,interaction
Python and C++ script interaction
0
1
5
4,827,083
1
0
0
I need a QCombox which Items are filtered based on the text input. If I set the QCombobox editable, the user can insert text and the QCompleter is automatically created. But the items are not filtered and I don’t want the user to add new Items. Is there any possibility to add this functionality to the QCombobox?
false
4,827,207
0.197375
0
0
5
Both answers posted are correct, however they have a small bug wherein filtering the options in the combobox by typing then clicking a selection doesn't cause an activation signal to fire. You can fix this by placing self.activated[str].emit(self.itemText(index)) in on_completer_activated, on the line after self.setCurrentIndex(index). This fires an activated signal when you select an item from the completer, which contains the name of the item that was clicked.
0
15,195
0
13
2011-01-28T10:32:00.000
python,qt,pyqt,qcombobox
How do I Filter the PyQt QCombobox Items based on the text input?
0
1
5
8,198,846
1
0
0
I want to draw arrows (that change size dynamically) within a Label or any other widget. I have these arranged as a grid. How can I do this? Would I need a Canvas? (not used yet ... currently just a grid of labels). I am using Python & Tkinter Gui library.
false
4,830,180
0
0
0
0
Tkinter does not support drawing on top of widgets. Your only choice for drawing arrows is to use a canvas. Your only other option is to draw directly on a image that is used by a label or button, but there's no support for that other than to set the value of individual pixels. Your only practical choice is to use a canvas.
0
1,937
0
0
2011-01-28T15:51:00.000
python,tkinter
Python Tkinter: Draw arrows within Label
0
1
3
4,840,199
1
0
0
I am quite confused about the stdin and the key_events of GUI widget. Usually in my mind, I thought stdin is the ordinary way to get the keyboard input for a process. E.g., If I have a process, then I could use stdin to have the keyboard inputs. And this is usually used to make I/O direction for the subprocess to get keyboard inputs. E.g., I could make subprocess.Popen(stdin=PIPE) On the other hand for GUI, I am using wx.TexCtrl or py.Shell.shell, to catch the key events, like inputs. So I am quite confused here, if I have a GUI or pyShell running, when I am typing via the keyboard, is it via the stdin or via the GUI key event catching system? If via the GUI key events system, how can I get the keyboard stdin? Can I still simply redirect the keyboard inputs to my child process (inside the GUI) as the ordinary non-GUI programming? Thanks a lot for any comments.
true
4,854,486
1.2
0
0
2
When you type, the input comes from the GUI event mechanism, not from stdin. You asked how to get the "keyboard stdin", and the answer to that is the same as for any other type of program: you read it (but it will almost certainly be empty). It's important to realize that the GUI probably doesn't have a stdin if it was started by double-clicking on an icon on the desktop. And no, you can't "redirect keyboard inputs to [your] child process", if I understand your question. Stdin really has absolutely nothing to do with GUIs at all. How keyboard input is read via a GUI is completely disconnected from stdin.
0
405
0
0
2011-01-31T18:18:00.000
user-interface,redirect,event-handling,wxpython,stdin
key_events of GUI widget and stdin
0
1
1
4,854,744
1
0
0
I can't seem to find the answer to this question anywhere. I realize that you have to use PyOpenGL or something similar to do OpenGL stuff, but I was wondering if its possible to do very basic 3D graphics without any other dependencies.
false
4,865,636
1
0
0
16
Well, if you can do 2d you can always do 3d. All 3d really is is skewed 2 dimensional surfaces giving the impression you're looking at something with depth. The real question is can it do it well, and would you even want to. After browsing the pyGame documentation for a while, it looks like it's just an SDL wrapper. SDL is not intended for 3d programming, so the answer to the real question is, No, and I wouldn't even try.
0
40,558
0
34
2011-02-01T17:08:00.000
python,3d,pygame
Does PyGame do 3d?
0
5
14
4,865,764
1
0
0
I can't seem to find the answer to this question anywhere. I realize that you have to use PyOpenGL or something similar to do OpenGL stuff, but I was wondering if its possible to do very basic 3D graphics without any other dependencies.
false
4,865,636
0
0
0
0
If you want to stick with a python-esque language when making games, Godot is a good alternative with both 2D and 3D support, a large community, and lots of tutorials. Its custom scripting language(gdscript) has some minor differences, but overall its mostly the same. It also has support for c# and c++, and has much more features when it comes to game development.
0
40,558
0
34
2011-02-01T17:08:00.000
python,3d,pygame
Does PyGame do 3d?
0
5
14
66,323,924
1
0
0
I can't seem to find the answer to this question anywhere. I realize that you have to use PyOpenGL or something similar to do OpenGL stuff, but I was wondering if its possible to do very basic 3D graphics without any other dependencies.
false
4,865,636
0
0
0
0
Pygame is just a library for changing the color of pixels (and some other useful stuff for programming games). You can do this by blitting images to the screen or directly setting the colors of pixels. Because of this, it is easy to write 2D games with pygame, as the above is all you really need. But a 3D game is just some 3D objects 'squashed' (rendered) into 2D so that it can be displayed on the screen. So, to make a 3D game using only pygame, you would have handle this rendering by yourself, including all the complex matrix maths necessary. Not only would this run slowly because of the immense processing power involved in this, but it would require you to write a massive 3D rendering/rasterisation engine. And because of python being interpreted it would be even slower. The correct approach would be to have this process run on the GPU using (Py)opengl. So, yes it is technically possible to do 3D using only pygame, but definitely not recommended. I would suggest you learn Panda3D or some similar 3D engine.
0
40,558
0
34
2011-02-01T17:08:00.000
python,3d,pygame
Does PyGame do 3d?
0
5
14
51,124,080
1
0
0
I can't seem to find the answer to this question anywhere. I realize that you have to use PyOpenGL or something similar to do OpenGL stuff, but I was wondering if its possible to do very basic 3D graphics without any other dependencies.
false
4,865,636
0.042831
0
0
3
Python Soya can render 3d graphics on pygame surfaces.
0
40,558
0
34
2011-02-01T17:08:00.000
python,3d,pygame
Does PyGame do 3d?
0
5
14
8,702,727
1
0
0
I can't seem to find the answer to this question anywhere. I realize that you have to use PyOpenGL or something similar to do OpenGL stuff, but I was wondering if its possible to do very basic 3D graphics without any other dependencies.
false
4,865,636
0.014285
0
0
1
It is easy to make 3D driver for PyGame. PyGame has some assets for 3D game development. I am developing Py3D driver using PyGame now. When I finish, I'll show you link to download Py3D. I tried to make 3D game with PyGame, and I needed just small addon for PyGame. It is wrong you think you must use SDL, PyOpenGL, OpenGL, PyQt5, Tkinter. All of them are wrong for making 3D games. OpenGL and PyOpenGL or Panda3D are very hard to learn. All my games made on those drivers were awful. PyQt5 and Tkinter aren't drivers for making games, but they've got addons for it. Don't try to make any game on those drivers. All drivers where we need to use the math module are hard. You can easily make small addon for them, I think everybody can make driver for PyGame in 1-2 weeks.
0
40,558
0
34
2011-02-01T17:08:00.000
python,3d,pygame
Does PyGame do 3d?
0
5
14
50,873,427
1
0
0
I'm trying to create a little web server that loads, using webkit, an URL to extract some data from the web page (eg: title, images sizes...). I'm using PyQt4 to access from python to webkit. For each request, I'm creating a QThread that: - creates an QWebPage object, - run an event loop - when the loading of the webpage has finished (loadFinished signal), some code extracts data from the mainFrame of the QWebPage and kills the QThread This works very well the first time, the web page is loaded, included all its resources (CSS, images). The second time I ask the server to load an url, the web page is loaded, but none of its resources (no css, no images). So when I try to retrieve image sizes, all size are set to 0,0. Here is some code snipset: # The QThread responsible of loading the WebPage class WebKitThread(QThread): def __init__(self, url): QThread.__init__(self) self.url = url self.start() def run(self): self.webkitParser = WebKitParser(self.url) self.exec_() class WebKitParser(QWebPage): def __init__(self, url, parent=None): QWebPage.__init__(self, parent ) self.loadFinished.connect(self._loadFinished) self.mainFrame().load(QUrl(url)) def _loadFinished(self, result): self.computePageProperties() QThread.currentThread().exit() def computePageProperties(self): # Some custom code that reads title, image size... self.computedTitle=XXXXXXXX The calling code (that respond to the HTTP request) is executing: t = WebKitThread(url) t.wait() # do some stuff with properties of WebKitParser print t.webkitParser.computedTitle
false
4,876,649
0.379949
0
0
2
I've managed to fix the issue: creating the QWebPage in the GUI thread (the thread of QApplication event loop) fixes the issue. It seems the second time a QWebPage is used, it tries to access to the browser cache (even if it has been disabled by configuration). But if the first QWebPage was not created in the main GUI thread, the cache is somewhat misconfigured and not usable. To create the QWebPage in the main GUI thread I'm using a custom QEvent (QEvent of type User) that triggers QWebPage initialization and result fetching.
0
628
0
2
2011-02-02T15:54:00.000
python,qt,qt4,pyqt4,qtwebkit
Unable to use in the same application a QWebPage twice
0
1
1
4,885,477
1
0
0
I am trying to use PyQt4. I have downloaded its LINUX version and trying to install it with Cygwin(because I have windows on my PC and I want to use linux, therefore I am using Cygwin). I don't know how to install it ? please guide me . There is no such file like setup.py, install....what should I do??
false
4,877,959
0.379949
0
0
2
PyQt4 and Qt are cross-platform. If you write cross-platform code, you don't need to develop on any specific OS. Testing on different platforms from time to time is a good idea, but good cross-platform code will usually just work. Don't use any Windows-specific features, Windows-specific code. In particular, don't use subprocess unless calling shell commands is part of your app, use os.path instead of writing paths yourself, don't hardcode any paths, verify that each library that you're using is cross-platform, and you'd be fine. And when you're testing on Linux, test on actual Linux. Cygwin is another, different platform. You can try using a virtual machine with VirtualBox. P.S. You might also look at Nokia's new PySide which has more liberal license than PyQt4 and supports most of what PyQt4 supports with nearly the same interface. It's a bit young, but by the time you complete your application, it would probably be more common.
1
526
0
1
2011-02-02T17:53:00.000
python,linux,pyqt4
pyqt4 on Linux environment
0
1
1
4,878,854
1
0
0
I would like to know if it is possible to minimise my python program to the system tray. Basically what it does is at every hour it takes a screenshot but I don't want it to stay on the task bar taking space. Could I make it go to the system tray area next to the clock but keep it running? I am not using tkinter or anything like that.
false
4,878,093
0
0
0
0
As opposed to having the program running continuously, why don't you use your system's scheduler? (Cron under *nix, Task Scheduler under windows). There might be a bit more overhead since it has to spin up Python each time, but it would be easier than hooking up a notification icon. Since you refer to it as the task bar, I assume Windows. To have a notification icon, you would have to have a hidden window, with a running message pump, so Windows has somewhere to send messages to for the icon. So, in short, much simpler just running a scheduled job.
1
2,796
0
2
2011-02-02T18:05:00.000
python
Minimize python to system tray in Windows (Vista)
0
2
3
4,878,220
1
0
0
I would like to know if it is possible to minimise my python program to the system tray. Basically what it does is at every hour it takes a screenshot but I don't want it to stay on the task bar taking space. Could I make it go to the system tray area next to the clock but keep it running? I am not using tkinter or anything like that.
true
4,878,093
1.2
0
0
2
Since you are running on Windows, you may simply want to rename your script to have a .pyw extension, so there is no console window. If you try to make a system tray application, you will need to pick a GUI toolkit like you've suggested, and your simple script will become a LOT bigger and far more complicated.
1
2,796
0
2
2011-02-02T18:05:00.000
python
Minimize python to system tray in Windows (Vista)
0
2
3
4,878,236
1
0
0
Is there an equivalent to Tkinter's place geometry manager in wxPython? For those those that don't know, place allows the positioning of widgets based on x y or relative x y coordinates. I'm a fan of this geometry manager simply because it offers a lot of control over widget positioning.
false
4,885,296
-0.099668
0
0
-1
The GridBagSizer or FlexGridSizer are kind of like Tkinter's place. Of course, wx also supports absolute positions, although I do not recommend that.
0
231
0
1
2011-02-03T11:00:00.000
python,geometry,wxpython
Equivalent to Tkinter's place geometry manager in wxPython
0
2
2
4,888,025
1
0
0
Is there an equivalent to Tkinter's place geometry manager in wxPython? For those those that don't know, place allows the positioning of widgets based on x y or relative x y coordinates. I'm a fan of this geometry manager simply because it offers a lot of control over widget positioning.
true
4,885,296
1.2
0
0
1
I think the best answer is "no, there is no equivalent". You can use absolute positioning with the "pos" keyword argument in the constructor, but that doesn't come close to the power of place.
0
231
0
1
2011-02-03T11:00:00.000
python,geometry,wxpython
Equivalent to Tkinter's place geometry manager in wxPython
0
2
2
4,888,233
1
0
0
I have created a gtk window in init and then I process a new function and i append the values from new function to the gtk window till the second function completes, the window gets unresponsive and can become responsive when second function completes. can anyone tell me whet should i do for the same?
false
4,886,652
0.379949
0
0
2
Windows become unresponsive in gtk (and in windowing systems in general) when you call a function within the Event Loop, which is the thread in charge of keeping the window responsive (this thread repaints the window, handles mouse clicks, etc.). If the function you call returns immediately, you won't notice the unresponsiveness, but if the function makes some heavy work, you'll have the situation you have described in your question. You should execute your second function in a thread of its own (a working thread). If you need to refresh your window after this function returns, make sure you make this update in the Event Loop (for example, invoking glib.idle_add) and not from the working thread! Otherwise, strange crashes may occur.
0
142
0
1
2011-02-03T13:17:00.000
python,gtk
python gtk problem
0
1
1
4,886,782
1
0
0
The idea is that I would have two or three different windows and I would like to open and close them automatically by calling a function (separate functions to open and close each window). The program itself would be running in the background but when a certain event happens it would call the window opening function. On another event the window would close, or window #2 would open etc. That's the general idea anyway. Right now I would settle for one window I could open by calling a function. So in a nutshell a function that opens a window but lets the program run in the background waiting for a command to destroy the window. Is it even possible to do that? I've searched for tkinter solutions, none have worked so far. The reason for tkinter is because wxpython won't close a window unless you move the mouse over it. Additionally, in the end I would be making borderless windows that are always on top of everything else. I have a somewhat suitable code for that already but it's nothing definitive. PS. Yes I know it's a poorly composed question. That's why I'm asking...
false
4,890,257
0.197375
0
0
1
In wxWindows you just call the .destroy() method on the dialog/window to delete it. You don't have to move the mouse over it. That would make wxWindows apps very annoying. I suspect your problem is more related to trying to do something outside the wx event framework. Most GUIs are event driven, so if you've got other things going on you either run them in another thread and have them signal the GUI framework to do stuff or run your code in an event handler callback that lets the event handler manage the .destroy() method you called in your code.
0
149
0
0
2011-02-03T18:39:00.000
python
Opening and closing windows by calling a function?
0
1
1
4,890,390
1
0
0
I'm about to undertake a .NET project: We need to create a create a program that utilize some existing C# code, and I'm hoping to use IronPython. (I'm an experienced Python programmer, but a bit of a .NET newbie). My question is: Is IronPython a good fit for using mostly C# code, or would it be better just to use C#? If IronPython is a good fit, are there any pitfalls to look out for?
false
4,890,407
0.099668
0
0
1
If you are in a Windows environment for reasons beyond your control, there are a lot of advantages in using IronPython. Its just like Python, only .NET. Once you learn the idosyncratic elements of how to reference an assembly, how to instantiate objects, browse objects, etc. it is really nice. You don't need Visual Studio to develop. Notepad++ or any decent text editor is all you need. If you really must have an IDE you can go with SharpDevelop. Now if you have VS2010, the new plugin for Ironpython is nice and should get better with future releases. With the introduction of Ironpython 2.7 and .NET 4.0, the startup time issues of previous versions have been mostly negated. I find the WPF and XAML approach much much easier than wx for creating GUI applications. Ironpython scripts can be compiled into exe's for easy distribution That said, there are downsides. Most packages do not install directly into Ironpython, forcing you to install into CPython, then copying over the relevant modules. Python extension that utilize pyd shared libraries don't work unless you use Ironclad, and even then you can have issues. You give up being cross platform, unless your users are running Mono and even then you lose some of the cool features like WPF. You are a bit behind the development curve. Ironpython is currently at 2.7 Beta 1 and has been since October, when Microsoft released the code into the wild. Prior to that no one outside of MS could submit patches. The community leadership is on track for a 2.7 RTM release in February and then starting the 3.x development.
1
801
0
3
2011-02-03T18:54:00.000
c#,.net,python,ironpython
Using C# code in IronPython
0
2
2
4,892,791
1
0
0
I'm about to undertake a .NET project: We need to create a create a program that utilize some existing C# code, and I'm hoping to use IronPython. (I'm an experienced Python programmer, but a bit of a .NET newbie). My question is: Is IronPython a good fit for using mostly C# code, or would it be better just to use C#? If IronPython is a good fit, are there any pitfalls to look out for?
true
4,890,407
1.2
0
0
5
You'll need to compile the C# code into an assembly (DLL) you can use within IronPython. Once you do this, IronPython can use this just like any other .NET assembly. This is a common usage scenario for IronPython.
1
801
0
3
2011-02-03T18:54:00.000
c#,.net,python,ironpython
Using C# code in IronPython
0
2
2
4,890,442
1
0
0
I'm trying to develop a C-based application which embeds one or more Python interpreters. I'm using gtk-things in the C-parts, and logically calling gtk_main() within that. The Python interpreters are created in separate pthreads using Py_NewInterpreter(), and basically running forever (a 'while True' loop is added to the end in case the script terminates). Now I'd like to use pyGTK in those scripts, which seems to work until there's a callback (signal emitted). You can register signal handlers to point to parts in the Python scripts ok, but it seems that the gtk main loop can't direct them correctly when they happen, causing segfaults like the log below. I'm guessing it might have something to do with the python thread state not being initialized correctly, but not sure. Would anyone have insight on what I'm doing wrong or what to check? #0 0xb7ecfc9a in PyFrame_New () from /usr/lib/libpython2.5.so.1.0 #1 0xb7f376ed in PyEval_EvalCodeEx () from /usr/lib/libpython2.5.so.1.0 #2 0xb7ed09b6 in ?? () from /usr/lib/libpython2.5.so.1.0 #3 0xb7eae327 in PyObject_Call () from /usr/lib/libpython2.5.so.1.0 #4 0xb7f30f7c in PyEval_CallObjectWithKeywords () from /usr/lib/libpython2.5.so.1.0 #5 0xb7eaeb5c in PyObject_CallObject () from /usr/lib/libpython2.5.so.1.0 #6 0xb424face in ?? () from /usr/lib/pymodules/python2.5/gtk-2.0/gobject/_gobject.so #7 0xb76e113a in g_closure_invoke () from /usr/lib/libgobject-2.0.so.0 #8 0xb76f761d in ?? () from /usr/lib/libgobject-2.0.so.0 #9 0xb76f8bfc in g_signal_emit_valist () from /usr/lib/libgobject-2.0.so.0 #10 0xb76f9076 in g_signal_emit () from /usr/lib/libgobject-2.0.so.0 #11 0xb7ab3a8a in gtk_button_clicked () from /usr/lib/libgtk-x11-2.0.so.0 #12 0xb7ab5048 in ?? () from /usr/lib/libgtk-x11-2.0.so.0 #13 0xb76eecac in g_cclosure_marshal_VOID__VOID () from /usr/lib/libgobject-2.0.so.0 #14 0xb76df7a9 in ?? () from /usr/lib/libgobject-2.0.so.0 #15 0xb76e113a in g_closure_invoke () from /usr/lib/libgobject-2.0.so.0 #16 0xb76f6eba in ?? () from /usr/lib/libgobject-2.0.so.0 #17 0xb76f8bfc in g_signal_emit_valist () from /usr/lib/libgobject-2.0.so.0 #18 0xb76f9076 in g_signal_emit () from /usr/lib/libgobject-2.0.so.0 #19 0xb7ab3b2a in gtk_button_released () from /usr/lib/libgtk-x11-2.0.so.0 #20 0xb7ab3b73 in ?? () from /usr/lib/libgtk-x11-2.0.so.0 #21 0xb7b70e74 in ?? () from /usr/lib/libgtk-x11-2.0.so.0 #22 0xb76df7a9 in ?? () from /usr/lib/libgobject-2.0.so.0 #23 0xb76e113a in g_closure_invoke () from /usr/lib/libgobject-2.0.so.0 #24 0xb76f7266 in ?? () from /usr/lib/libgobject-2.0.so.0 #25 0xb76f8a7b in g_signal_emit_valist () from /usr/lib/libgobject-2.0.so.0 #26 0xb76f9076 in g_signal_emit () from /usr/lib/libgobject-2.0.so.0 #27 0xb7c9d156 in ?? () from /usr/lib/libgtk-x11-2.0.so.0 #28 0xb7b694cd in gtk_propagate_event () from /usr/lib/libgtk-x11-2.0.so.0 #29 0xb7b6a857 in gtk_main_do_event () from /usr/lib/libgtk-x11-2.0.so.0 #30 0xb79f3dda in ?? () from /usr/lib/libgdk-x11-2.0.so.0 #31 0xb7636305 in g_main_context_dispatch () from /lib/libglib-2.0.so.0 #32 0xb7639fe8 in ?? () from /lib/libglib-2.0.so.0 #33 0xb763a527 in g_main_loop_run () from /lib/libglib-2.0.so.0 #34 0xb7b6ae19 in gtk_main () from /usr/lib/libgtk-x11-2.0.so.0
false
4,896,434
0
0
0
0
This is a situation where you are better off making one more Python interpreter and doing all your GTK work by sending Python snippets to that special GTK helper interpreter. That way your C code never uses GTK directly and you only need to worry about coordinating between the Python threads.
0
285
0
2
2011-02-04T09:30:00.000
python,c,multithreading,gtk,pygtk
pygtk and native gtk_main(); mixing
0
2
2
4,911,145
1
0
0
I'm trying to develop a C-based application which embeds one or more Python interpreters. I'm using gtk-things in the C-parts, and logically calling gtk_main() within that. The Python interpreters are created in separate pthreads using Py_NewInterpreter(), and basically running forever (a 'while True' loop is added to the end in case the script terminates). Now I'd like to use pyGTK in those scripts, which seems to work until there's a callback (signal emitted). You can register signal handlers to point to parts in the Python scripts ok, but it seems that the gtk main loop can't direct them correctly when they happen, causing segfaults like the log below. I'm guessing it might have something to do with the python thread state not being initialized correctly, but not sure. Would anyone have insight on what I'm doing wrong or what to check? #0 0xb7ecfc9a in PyFrame_New () from /usr/lib/libpython2.5.so.1.0 #1 0xb7f376ed in PyEval_EvalCodeEx () from /usr/lib/libpython2.5.so.1.0 #2 0xb7ed09b6 in ?? () from /usr/lib/libpython2.5.so.1.0 #3 0xb7eae327 in PyObject_Call () from /usr/lib/libpython2.5.so.1.0 #4 0xb7f30f7c in PyEval_CallObjectWithKeywords () from /usr/lib/libpython2.5.so.1.0 #5 0xb7eaeb5c in PyObject_CallObject () from /usr/lib/libpython2.5.so.1.0 #6 0xb424face in ?? () from /usr/lib/pymodules/python2.5/gtk-2.0/gobject/_gobject.so #7 0xb76e113a in g_closure_invoke () from /usr/lib/libgobject-2.0.so.0 #8 0xb76f761d in ?? () from /usr/lib/libgobject-2.0.so.0 #9 0xb76f8bfc in g_signal_emit_valist () from /usr/lib/libgobject-2.0.so.0 #10 0xb76f9076 in g_signal_emit () from /usr/lib/libgobject-2.0.so.0 #11 0xb7ab3a8a in gtk_button_clicked () from /usr/lib/libgtk-x11-2.0.so.0 #12 0xb7ab5048 in ?? () from /usr/lib/libgtk-x11-2.0.so.0 #13 0xb76eecac in g_cclosure_marshal_VOID__VOID () from /usr/lib/libgobject-2.0.so.0 #14 0xb76df7a9 in ?? () from /usr/lib/libgobject-2.0.so.0 #15 0xb76e113a in g_closure_invoke () from /usr/lib/libgobject-2.0.so.0 #16 0xb76f6eba in ?? () from /usr/lib/libgobject-2.0.so.0 #17 0xb76f8bfc in g_signal_emit_valist () from /usr/lib/libgobject-2.0.so.0 #18 0xb76f9076 in g_signal_emit () from /usr/lib/libgobject-2.0.so.0 #19 0xb7ab3b2a in gtk_button_released () from /usr/lib/libgtk-x11-2.0.so.0 #20 0xb7ab3b73 in ?? () from /usr/lib/libgtk-x11-2.0.so.0 #21 0xb7b70e74 in ?? () from /usr/lib/libgtk-x11-2.0.so.0 #22 0xb76df7a9 in ?? () from /usr/lib/libgobject-2.0.so.0 #23 0xb76e113a in g_closure_invoke () from /usr/lib/libgobject-2.0.so.0 #24 0xb76f7266 in ?? () from /usr/lib/libgobject-2.0.so.0 #25 0xb76f8a7b in g_signal_emit_valist () from /usr/lib/libgobject-2.0.so.0 #26 0xb76f9076 in g_signal_emit () from /usr/lib/libgobject-2.0.so.0 #27 0xb7c9d156 in ?? () from /usr/lib/libgtk-x11-2.0.so.0 #28 0xb7b694cd in gtk_propagate_event () from /usr/lib/libgtk-x11-2.0.so.0 #29 0xb7b6a857 in gtk_main_do_event () from /usr/lib/libgtk-x11-2.0.so.0 #30 0xb79f3dda in ?? () from /usr/lib/libgdk-x11-2.0.so.0 #31 0xb7636305 in g_main_context_dispatch () from /lib/libglib-2.0.so.0 #32 0xb7639fe8 in ?? () from /lib/libglib-2.0.so.0 #33 0xb763a527 in g_main_loop_run () from /lib/libglib-2.0.so.0 #34 0xb7b6ae19 in gtk_main () from /usr/lib/libgtk-x11-2.0.so.0
false
4,896,434
0
0
0
0
This looks like a pretty long stack, and some of the functions called look the same. (For example, g_signal_emit is called repeatedly from itself via g_closure_invoke.) It looks to me like you may be causing a stack overflow, possibly by emitting a signal inside your callback that handles the signal, thus infinitely recursing until you run out of stack space and crash. This is just a guess and I don't know much about the GTK+/GLIB internals, but that is what it smells like to me. I'd put money on it. :-) If not that, then maybe the GLIB closures are being chained too much (one callback calls another callback which calls another etc. etc. until you run out of space.) Maybe adjusting your stack size would help. (I don't remember offhand if there is an easy way to do this for main(), but if you're creating a new thread pthread_attr_setstacksize() might help.)
0
285
0
2
2011-02-04T09:30:00.000
python,c,multithreading,gtk,pygtk
pygtk and native gtk_main(); mixing
0
2
2
4,911,173
1
0
0
I'm a 2nd year university student, and I thought it would be a good idea to expand my abilities. I will be using python later this year to complete a gui for a C program (using Tkinter), but I want to make a side project as well, and python seems like a great language to do it with. I want a project which has multiple levels for me to code, so it's definitely going to have a gui and command-line version, and then maybe some database stuff (since I would like to know more about SQL and other database tech). I thought I could make a music player. Start by just making a command line program which plays a music file, then expand it from there, probably using pygtk for the gui. Considering I have no python experience, but I do have a strong background in C and Java, are there going to be any difficulties which will unexpectedly stop me? I have never made a music application before, and I am not sure whats involved in keeping a music library, for example. Are there any other projects you might recommend, that can be completed in about an hour a night, for 3 months? (Or get a significant working program out of it, even if its not complete). Thanks!
false
4,898,747
0.066568
0
0
2
Writing a program will help you learn the language, but IMHO joining the development team of an open-source python project would help you learn even more, as reading high-quality code written by other developers will disclose to you features of the language that you would never discover alone. So, my suggestion is to hunt for a smallish and high-quality python open source project, read its code, understand what it does and then start contributing. It might help to choose a project that you use or that you like.
0
9,115
0
2
2011-02-04T13:57:00.000
python,project,pygtk
A good side-project for learning python?
0
2
6
4,898,798
1
0
0
I'm a 2nd year university student, and I thought it would be a good idea to expand my abilities. I will be using python later this year to complete a gui for a C program (using Tkinter), but I want to make a side project as well, and python seems like a great language to do it with. I want a project which has multiple levels for me to code, so it's definitely going to have a gui and command-line version, and then maybe some database stuff (since I would like to know more about SQL and other database tech). I thought I could make a music player. Start by just making a command line program which plays a music file, then expand it from there, probably using pygtk for the gui. Considering I have no python experience, but I do have a strong background in C and Java, are there going to be any difficulties which will unexpectedly stop me? I have never made a music application before, and I am not sure whats involved in keeping a music library, for example. Are there any other projects you might recommend, that can be completed in about an hour a night, for 3 months? (Or get a significant working program out of it, even if its not complete). Thanks!
true
4,898,747
1.2
0
0
10
Considering I have no python experience, but I do have a strong background in C and Java, are there going to be any difficulties which will unexpectedly stop me? Yes. I have never made a music application before, and I am not sure whats involved in keeping a music library, for example. That will stop you. Want advice? Step 1. Avoid asking yes/no questions. Step 2. Start smaller. [see below] Step 3. Start with a tutorial on Python. Step 4. Find related projects, download their code, and read it. On Starting Smaller. "about an hour a night, for 3 months". 90 hours. Allocate 40 hours to do enough Python tutorials to understand the language. Ordinarily, I'd suggest 80 hours for this, but your budget is tight. Allocate another 40 hours to working out how the sound playback API's work on your platform. This may be too much time, but there are always odd mysteries. OS API and Device Driver issues are often difficult problems to solve. Allocate another 40 hours to make enough mistakes to get a PyGTK application that runs respectably well. Ordinarily, I'd allocate at least 120 hours to this, since GUI design includes lots of new concepts, not covered in the language tutorials. Again, your budget is tight. Learning SQL and Database design and an ORM API. Perhaps 40 hours. There are a lot of mistakes you can make here, and you'll need time to make those mistakes. Allocate another 40 hours to creating some kind of "music library" built on existing file system API's. This involves defining some use cases for add, change and delete and figuring out how to implement those use cases. That's my rationale for suggesting that you may want to "start smaller".
0
9,115
0
2
2011-02-04T13:57:00.000
python,project,pygtk
A good side-project for learning python?
0
2
6
4,898,770
1
0
0
i've built a com component which utilizes libxml2 python bindings , the build is successfull but when i try to register the component i get "specified module could not be found , unable to load python dll" this is the error i get when the component is built using the bundle files option set as 1 if i build the component with bundle files set as 3 ,then i get a different error saying that the component was loaded but the call to DllRegisterServer Failed with error code 80040201 if the libxml2 import is removed all works fine. any help wold be simply great. thanks
false
4,899,158
0.197375
1
0
1
Most likely, regsvr32.exe which registers you COM component couldn't find a DLL that your COM component needs. I'm not familiar with Python COM components but is there some way you can run depends.exe on it? This is the usual way to track down binary dependency problems.
0
240
0
0
2011-02-04T14:33:00.000
python,com
python com component does not register when using libxml2 on win7
0
1
1
4,899,486
1
0
0
In order to indicate activity, some applications (e.g. Pidgin) highlight their entry in GNOME's Window List panel widget (e.g. via bold font or flashing color). This indication is reset automatically when the window is activated. I have a terminal application for which I would like to achieve the same thing (preferably via Perl, but Python would work too) - but I have no idea where to start. I imagine I'd first have to find the terminal window (based on window title) and then trigger some kind of GTK action. Any help would be greatly appreciated!
false
4,906,424
0.099668
0
0
1
I'm not really into GTK programming, but as far as i know you want to set an "URGENT"-Flag for the Window which should be highlighted. Maybe this will get you any further. :)
0
495
1
1
2011-02-05T10:51:00.000
python,perl,gtk
highlighting a window in GNOME's window list
0
1
2
4,906,739
1
0
0
How can i set up icon for my existing program.exe and icon.ico ( in the same folder ) using some sort of hidden (settings) file ? Edit: i am aware of py2exe CustomIcon option, also about WinRar Sfx ... Question is: it is possible in this specific way i described ?
false
4,915,202
0
0
0
0
do it like this: If you dont have winrar then install it! Then right click on your program.exe and select "Add to archive...", under "Archiving options" select "Create SFX Archive". Now go to tab "Advanced" and click on "SFX Options" on "General tab" setup all you need and add "Run after extraction" (yourprogram.exe) under "Modes" tab select "Hide All" under silent groupbox, go to "Update" tab and select "Update Mode" (Extract and replace files) and "Overwrite mode" (Overwrite all files) now go to "TextAndIcon" tab and put to title yourprogram.exe name and under "Load SFX icon from the file" add an icon you want! Click OK, and click OK again. Now wait to compile and you have your program with icon! Just have to watch where you want it to be installed, or if it doesnt have any install direction then you use "Unpack to temporary folder" under the "Modes" tab in "SFX Options"! Think this will help you! :)
1
1,915
0
0
2011-02-06T18:22:00.000
python,icons,exe,ico
How to set up icon for a program?
0
1
2
4,915,328
1
0
1
I'm writing a program in Python. The first thing that happens is a window is displayed (I'm using wxPython) that has some buttons and text. When the user performs some actions, a plot is displayed in its own window. This plot is made with R, using rpy2. The problem is that the plot usually pops up on top of the main window, so the user has to move the plot to see the main window again. This is a big problem for the user, because he's lazy and good-for-nothing. He wants the plot to simply appear somewhere else, so he can see the main window and the plot at the same time, without having to lift a finger. Two potential solutions to my problem are: (1) display the plot within a wxPython frame (which I think I could control the location of), or (2) be able to specify where on the screen the plot window appears. I can't figure out how to do either.
true
4,938,556
1.2
0
0
5
Plot to a graphics file using jpeg(), png() or another device, then display that file on your wxWidget.
0
757
0
3
2011-02-08T21:17:00.000
python,r,plot,rpy2
How do I control where an R plot is displayed, using python and rpy2?
0
1
2
4,938,599
1
0
0
I have an image wiht gtk.gdk. I want to make it look grayed out, so I wanna do something like draw a gray rectangle over it with 50% alpha value. How would I do this? The docs are so confusing.
false
4,947,341
0
0
0
0
i just thought of a way taking half of the color's highest values and taking half of the number directly between them and putting that on the lowest number (Eg: 0,255,255 to 127,255,255 or 0,127,255 to 96,127,255) or taking the second highest number and the highest number, finding the 50%, putting that as the second highest number, then doing that again for the absolute lowest number (Eg: 0,128,255 > 112,192,255) hope this works for me and for you, right now im recommending to myself and you, the second option, however if you're lazy, the first option is less work
0
246
0
0
2011-02-09T16:03:00.000
python,pygtk,gtk,gdk
gtk.gdk: make image 50% grayer
0
1
1
22,739,002
1
0
0
I want to read data from a text field. The name of the text field is not defined of found in the other class with methods of reading the text field. The textfield is defined in the Design class. now how do I access this field from another class, so I can read data from it. Thanks!! Edit: I have 2 Classes: FeatureImportCommonWidget(QtGui.QWidget) and MetaDataBrowser. FeatureImportCommonWidget contains a Text Field called placesGroupBox. I want to access this text field in the MetaDataBrowser Class. I tried it using "filename = get_metadata.placesGroupBox.text()", but it gives an error about placesGroupBox not being defined in the MetaDataBrowser class.
false
4,967,179
0
0
0
0
If the field's an ordinary attribute called text and your Design instance is called design, you can access (read/write) it from anywhere as design.text.
1
179
0
0
2011-02-11T09:01:00.000
python,pyqt
Python Referencing
0
2
2
4,968,555
1
0
0
I want to read data from a text field. The name of the text field is not defined of found in the other class with methods of reading the text field. The textfield is defined in the Design class. now how do I access this field from another class, so I can read data from it. Thanks!! Edit: I have 2 Classes: FeatureImportCommonWidget(QtGui.QWidget) and MetaDataBrowser. FeatureImportCommonWidget contains a Text Field called placesGroupBox. I want to access this text field in the MetaDataBrowser Class. I tried it using "filename = get_metadata.placesGroupBox.text()", but it gives an error about placesGroupBox not being defined in the MetaDataBrowser class.
false
4,967,179
0
0
0
0
1. if object of FeatureImportCommonWidget class is created inside of MetaDataBrowser class, you can access your text field anywhere inside MetaDataBrowser class like this: FeatureImportCommonWidgetObjectName.placesGroupBox.text() 2 if object of FeatureImportCommonWidget class is created before MetaDataBrowser class, you can pass that object as parameter to MetaDataBrowser class and then access your text field anywhere inside MetaDataBrowser class like in step 1
1
179
0
0
2011-02-11T09:01:00.000
python,pyqt
Python Referencing
0
2
2
17,676,533
1
0
0
Just wondering whether there is any provision/method to bind clicks on images/(or include a button) to result into some events. Also is there any kind of way to draw a StaticLine kind of thing in a RichTextCtrl in wxPython.
false
4,967,307
0
0
0
0
You can bind to a button if you like, you could use a bitmapbutton instead, or bind mouse events to your static bitmap. The wxPython demo has examples for all of these methods. With regards to the "StaticLine kinda thing", are you trying to resize the richtextctrl on demand? You might want to look at the ExpandoTextCtrl instead, which is also demonstrated in the demo. If not, I would need some more detail than "kinda thing".. ;)
0
239
0
1
2011-02-11T09:15:00.000
python,user-interface,wxpython,wxtextctrl,wx.textctrl
wxpython RichtextCtrl event bindings on buttons/images
0
1
1
5,696,978
1
0
0
Is there a fast python way to save all data in all widgets to file before app is close? And of course read it and restore after app is re-run?
true
4,972,429
1.2
0
0
4
QWidget.saveGeometry saves the geometry of an widget. QMainWindow.saveState saves the window's toolbars and dockwidgets. To save other things you can use pickle.
0
2,185
0
3
2011-02-11T18:01:00.000
python,pyqt
PyQt 4 - save all data in window to file on app close
0
1
2
4,974,374
1
0
0
I'd like to create a PyThreadState since there doesn't appear to be one for the current thread. How do I get the current PyInterpreterState to pass to PyThreadState_New(...), or is that something that I should only do if I'm embedding an interpreter (and thus have created it), rather than calling into a library from python?
true
4,987,579
1.2
0
0
1
It turns out that not having a PyThreadState in the main thread is a fatal error. It was caused for me by two different python versions both being linked at the same time, so this question is somewhat moot.
1
1,482
0
2
2011-02-13T23:16:00.000
python,c,multithreading,python-c-api
How do I get the current PyInterpreterState?
0
1
3
5,002,035
1
0
0
As a hobbyists who has a little experience making 2D games using PyGame, and has ventured into using C++ with the SDL library (in Visual Studio), I'm curious. Is the library used professionally?
false
4,993,101
0.291313
0
0
3
SDL is used professionally and some great games were made with it. Many times it is used as a cross-platform window creation system to initialize openGL (as I assume it is used for Doom3, UT, etc...). It is also used for as "raw" 2d graphics API (for example in Battle For Wesnoth).
1
769
0
4
2011-02-14T14:08:00.000
c++,python,sdl,pygame
Is C++ SDL and (Python PyGame) used by people other than hobbyists?
0
1
2
4,993,955
1
0
0
I'm writing a small cross-platform wxPython app, however on every platform I need to use some platform-specific API. On Mac OS it can be done using PyObjC. I'm searching for tutorial on how to use PyObjC. However, all I found so far were tutorials with Xcode. I want my app to be able to run on mac/win/lin, without changes, and I don't want to develop it in Xcode. Is there a way? UPD. To be more specific I need to access some pen-tablet events from Mac OS X and I wanted to use PyObjC for that (I don't see any other ways).
false
4,994,058
0
0
0
0
What do you need Xcode for? If you need it for the windows/gui (*.nib, *.xib files), then you should perhaps search for 'creating *.nib, *xib without Xcode'. That's only a search hint and no satisfying answer.
1
3,791
0
6
2011-02-14T15:39:00.000
python,macos,wxpython,pyobjc
PyObjC tutorial without Xcode
0
1
2
5,071,853
1
0
0
I'm trying to make a small game that supports Python scripting. I've no problems with using the Python C-API, but I don't know how to ensure that the game will run on a computer with no Python installed. I know I need pythonXY.dll -- what else is there? When I try to run the program it tells me it cannot find encodings.utf_8. I tried copying the encodings/utf_8.py file in the same directory as my program, but the error still pops up.
true
4,995,336
1.2
1
0
0
You need the encodings/__init__.py file, otherwise encodings is a folder and not a python package. Chances are that you'll need a lot of stuff from within the python standard library. To make everything just work you'll need to include the entire standard library along with your program. You can make this a bit better by putting the library in a zip file and adding that to sys.path. Also, you can include only pyc not the original py files.
1
258
0
2
2011-02-14T17:40:00.000
python,embed,python-c-api
C++ Python embedding: Run on machine with no Python?
0
1
1
4,995,435
1
0
0
I want to write a python script to convert PNG's into 2-page pdfs (i.e. 2 PNGs per PDF). The software needs to run on both a Mac and Windows 7. My current solution is using ReportLab, but that doesn't install easily on a Mac. According to its website, it only has a compiled version for Windows. It has a cross-platform version that requires a C compiler to install. Is there a better way to do this (so that I don't have to install a C compiler on the Mac)? Should I use a different library, or a different language entirely? As long as I can call the program from a python script, I could use any language for the pdf creation. Or, is there a very straightforward (i.e a non-programmer could install it) C compiler that I could install on a Mac? What do you recommend?
false
4,999,660
0.049958
0
0
1
PyCairo could be a good alternative. You'll have full control and less dependencies, but reportlab is a lot simplier.
1
8,947
0
6
2011-02-15T03:36:00.000
python,pdf-generation,reportlab
Using python to convert PNG's into PDF's
0
1
4
7,099,416
1
0
0
Have downloaded VLC.py, and placed it in my VLC install directory, where libvlc.dll is also present On typing import vlc I get the following error Traceback (most recent call last): File "C:\Program Files (x86)\VideoLAN\VLC\vlc.py", line 88, in dll = ctypes.CDLL('libvlc.dll') File "C:\Python27\lib\ctypes__init__.py", line 353, in init self._handle = _dlopen(self._name, mode) WindowsError: [Error 193] %1 is not a valid Win32 application Any ideas why? If needed, my config is: Win7 pro 64 bit 4GB RAM
true
5,007,455
1.2
0
0
3
Reposting my comment as an answer, since it fixed the problem: I'm going to guess that the problem is trying to load a 32-bit DLL from a 64-bit process. You may be able to fix it by using a 32-bit Python build.
0
2,520
0
0
2011-02-15T17:55:00.000
python,vlc
VLC Python Bindings -- Error 193
0
1
1
5,033,072
1
0
0
What's the best way to draw rotated text rendered with fonts with pygame? I can just draw the font then rotozoom it, but it seems better result would be gotten if it were possible to draw the glyphs directly rotated, especially taking AA into account?
false
5,007,478
0
0
0
0
You can use a pyOpenGL surface in pygame, if that simplifies it for you. Pyglet also uses OpenGL. (for pygame surfaces) You can cache the rendered text, using that to rotate. Or pre-cache all 32 directions. [ see other answer ]
0
2,142
0
0
2011-02-15T17:57:00.000
python,fonts,rotation,render,pygame
draw rotated font with pygame
0
1
2
5,691,673
1
0
0
I have a wxPython app with one frame and one panel. On that panel are a number of static boxes, each of which has buttons and textboxes. I have just begun reading about sizers, but they seem like they might be more than what I need, or it could that they are exactly what I need but I don't know how to use them correctly! The frame currently opens at 1920 x 1080. If the user drags the bottom right corner to resize the app, I just want everything to get smaller or larger as needed to keep the same size ratio. Is this possible? Thank you! edit: additional info: I used wxPython 2.8 and Boa to construct the GUI. I am contemplating trying another gui ide. So after reading some more about sizers, I am thinking about doing the following: add a gridsizer and basically divide my window's elements into rows and columns, then set each row and column's size as necessary until I achieve the original layout. Then I guess set the rows and columns to resize correctly? Is this a decent idea?
false
5,012,257
0.197375
0
0
1
For complex layouts, I sketch it out on a piece of paper. Then I draw boxes around the widgets in different ways to decide what sizers to use. You can nest pretty much any sizer inside another one. If the controls naturally fit in a grid, then using a grid sizer of some sort is probably alright. If not, then use BoxSizers. I tend to use those the most.
0
301
0
1
2011-02-16T03:31:00.000
python,wxpython,boxsizer
Simple wxPython Frame Contents Resizing - Ratio?
0
1
1
5,018,264
1
0
0
Im currently working on a project with pygame and am in need of being able to view part of a surface, moving around, zooming in and out ect Can anyone recommend a way of achieving this efficently, i have it working in a convoluted method at the moment but it is too slow and reduces the game to about 1fps when zoomed out to view the whole area. (my version of only scrolling and no zooming works fine with no lagging) Looking though the docs pygame.transform.scroll looks promising but i am unsure how i would correctly implement it with pygame.transform.scale for zooming in and out Any help welcome update: I fiddled around for a bit and got it working scaleing objects and their positions before bliting them. I have now hit the problem that the scaling looks unatural because of the low resolution of the pygame scroll wheel events so I am now trying to impliment some kind of smoothing.
false
5,014,993
0
0
0
0
For a game that I have never finished I used trigonometry to get the new drawing positions with a freely zoomed and turned camera (bit complicated). It didn't really take to much time to calculate but I think it is more efficient to use other libraries. But if you want some examples just ask.
0
7,328
0
5
2011-02-16T10:02:00.000
python,scroll,zooming,transform,pygame
Pygame zooming/scrolling window
0
2
3
13,349,846
1
0
0
Im currently working on a project with pygame and am in need of being able to view part of a surface, moving around, zooming in and out ect Can anyone recommend a way of achieving this efficently, i have it working in a convoluted method at the moment but it is too slow and reduces the game to about 1fps when zoomed out to view the whole area. (my version of only scrolling and no zooming works fine with no lagging) Looking though the docs pygame.transform.scroll looks promising but i am unsure how i would correctly implement it with pygame.transform.scale for zooming in and out Any help welcome update: I fiddled around for a bit and got it working scaleing objects and their positions before bliting them. I have now hit the problem that the scaling looks unatural because of the low resolution of the pygame scroll wheel events so I am now trying to impliment some kind of smoothing.
false
5,014,993
0
0
0
0
You can use pygame with OpenGL, since you are already familiar with pygame. Otherwise pyglet is a similar opengl library.
0
7,328
0
5
2011-02-16T10:02:00.000
python,scroll,zooming,transform,pygame
Pygame zooming/scrolling window
0
2
3
7,509,780
1
0
0
I am trying automatically generate buttons to a menu using PIL in python. The button should be small rectangular and have a little gradient from one color to another, and a little text in it. Is PIL the best way to do this, or is Cairo a better alternative? Any suggestion to how I can accomplish this without having a image to start with..?
true
5,022,891
1.2
0
0
1
You can do this entirely with PIL if you start with a single pre-made white-to-black gradient image (that you've made in some other program) and then use the ImageChops module to manipulate this together with your primary image to get what you want. For example to if you want to fade from red to blue: multiply red by the gradient, flip the gradient and multiply blue by this, and add these together. If your images vary in size, you can scale the gradient image appropriately in PIL.
0
413
0
1
2011-02-16T22:25:00.000
python,python-imaging-library,cairo
Generating a shaded button using PIL
0
1
2
5,024,687
1
0
0
For a computer architecture assignment, I am trying to replace a C++ library called "Sim" with something in Python. I am already using MyHDL for the simulator, but the C++ program has a nice interactive feature that lets students see the components connected together (gates, inputs, outputs, flip flops, etc.) and toggle any signal. I am attempting to create that interactive aspect and I just need to pick the library to use. I was wondering if wxPython would be a good choice in this case. The GUI mainly needs to draw gates or devices like flip flops and counters, use lines to connect them, and have some representation of signals (0 and 1 for instance or black and white). Is wxPython a good idea, or are there better libraries for this application?
false
5,038,022
0
0
0
0
wxPython and PyQt both are good option. I find Qt easy as compare to wxPython.
0
441
0
3
2011-02-18T05:40:00.000
python,wxpython,computer-architecture
Is wxPython good for a Hardware Simulator?
0
2
3
5,039,125
1
0
0
For a computer architecture assignment, I am trying to replace a C++ library called "Sim" with something in Python. I am already using MyHDL for the simulator, but the C++ program has a nice interactive feature that lets students see the components connected together (gates, inputs, outputs, flip flops, etc.) and toggle any signal. I am attempting to create that interactive aspect and I just need to pick the library to use. I was wondering if wxPython would be a good choice in this case. The GUI mainly needs to draw gates or devices like flip flops and counters, use lines to connect them, and have some representation of signals (0 and 1 for instance or black and white). Is wxPython a good idea, or are there better libraries for this application?
false
5,038,022
0.066568
0
0
1
wxPython or pyside (Qt python bindings) are both ideal for this. wx is a little better if you have any MFC experience, Qt is perhaps a more modern design.
0
441
0
3
2011-02-18T05:40:00.000
python,wxpython,computer-architecture
Is wxPython good for a Hardware Simulator?
0
2
3
5,038,058
1
0
0
I need to listen for certain keypresses in a python terminal program without pausing execution with raw_input. I've seen people use a few windows specific ways of listening for keystrokes and I've seen people use large modules like tkinter and pygame which I want to avoid. Is there a lightweight module out there that does this cross platform (at least ubuntu, windows, mac)? or is there a way to use just the event system from tkinter, pygame, etc...? If not, how should I approach tackling this? My first thought is to redirect stdin to another process and keep checking to see if it contains one of my event keys. edit Thank you @unutbu for taking the time to mark this question that is 3 years old and successfully answered as a duplicate of another question whose answers do not apply to this question because I specifically asked about a non-blocking solution.
false
5,044,073
1
0
0
6
Short answer: no Keypresses are system-dependent. They are interrupt-driven. They one of the basic things built into most modern OSes. They have different philosophies that can't be unified in a generic way without losing functionality. you might try- termios = unix, posix-style file-descriptor driven curses = portal terminal-style handling (which is a specific console-based paradigm not generic) Python wraps certain classes of input that might come from the keyboard: e.g., sys.stdin for console inupt. But trying to get universal keyboard input is a very general problem that's inherently platform-dependent.
0
20,515
0
21
2011-02-18T16:48:00.000
python,keyboard-events
Python cross-platform listening for keypresses?
0
1
4
5,047,120
1