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 | for python2.x py2app will do the work. But for python3 code which one is alternate to go ahead?
Or is there any other way to get single .app file? | false | 3,307,083 | 0 | 0 | 0 | 0 | py2app claims to support Python 3, so you should be able to use it. | 1 | 231 | 0 | 1 | 2010-07-22T08:38:00.000 | python,macos,python-3.x | How to convert python3-pyqt code into .app file for mac os x? | 0 | 1 | 1 | 5,049,583 | 1 |
0 | 0 | When I compiled Python using PCBuild\build.bat I discovered that several Python external projects like ssl, bz2, ... were not compiled because the compiler did not find them.
I did run the Tools\Buildbot\external.bat and it did download them inside \Tools\ but it looks that the build is not looking for them in this location and the PCBuild\readme.txt does not provide the proper info regarding this.
In case it does matter, I do use VS2008 and VS2010 on this system.
Example:
Build log was saved at "file://C:\dev\os\py3k\PCbuild\Win32-temp-Release\_tkinter\BuildLog.htm"
_tkinter - 2 error(s), 0 warning(s)
Build started: Project: bz2, Configuration: Release|Win32
Compiling...
bz2module.c
..\Modules\bz2module.c(12) : fatal error C1083: Cannot open include file: 'bzlib.h': No such file or
directory | true | 3,307,813 | 1.2 | 0 | 0 | 2 | Tools\buildbot\external.bat must be run from py3k root, not from Tools\buildbot\ subdir as you did. Also to build release version of python with Tkinter support you have to edit or copy Tools\buildbot\external.bat to remove DEBUG=1 so it can build tclXY.dll/tkXY.dll (without -g suffix). | 0 | 872 | 0 | 1 | 2010-07-22T10:20:00.000 | python | How to compile Python with all externals under Windows? | 0 | 1 | 1 | 3,683,128 | 1 |
0 | 0 | Could someone tell me which is better of the two for bundling Python applications — cx_Freeze or PyInstaller? I'm looking for a comparison based on factors such as:
Popularity (i.e. larger user base)
Footprint of the built binary
Cross platform compatibility
Ease of use | false | 3,307,966 | 1 | 0 | 0 | 26 | I tried both for a current project and decided to use cx_freeze. I found it easier to get started. It has an option to bundle dependencies in a zip archive, which makes it easy to check that everything was properly included.
I had trouble getting PyInstaller to include certain egg dependencies. It couldn't handle conditional imports as well as I needed and looking through the bundled archive was difficult. On Windows, it requires pywin32 (so it can't be used with virtualenv) and version 1.4 doesn't work with Python 2.6. There's no information on whether Python 2.7 is supported. | 1 | 20,447 | 0 | 37 | 2010-07-22T10:45:00.000 | python,pyinstaller,cx-freeze | Which is better - PyInstaller or cx_Freeze? | 0 | 1 | 2 | 3,368,456 | 1 |
0 | 0 | I am compiling on Ubuntu 10.04 LTS. The Perforce Python API uses their C++ API for some of it. So, I point the setup.py at the C++'s API directory using the --apidir= they say to use. When it starts to compile the C++, I get a whole load of errors (temporary error list link is now gone). No one else has had these errors as far as I can tell. So, my question is, is it my idiocy, or Perforce's?
P.S. The reason I don't have the flag in the command is because I setup the setup.cfg file to point at the API. | true | 3,324,490 | 1.2 | 1 | 0 | 0 | Woops! Forgot I still needed to install python-dev... | 0 | 290 | 0 | 0 | 2010-07-24T09:08:00.000 | c++,python,perforce | Perforce P4Python API Bug | 0 | 1 | 1 | 3,324,560 | 1 |
0 | 0 | Is there any difference in speed of copying files from one location to another betwen python or delphi or c++ ?
I guess that all 3 laguages uses same or similar win api calls and that there is not much performance difference. | false | 3,324,870 | 0.197375 | 1 | 0 | 1 | Pythons shutil module does not use the Windows API, but instead uses an open/read/write loop. This may or may not be slower than using CopyFile(Ex). Please measure it, everything else is just guessing. | 0 | 78 | 0 | 0 | 2010-07-24T11:17:00.000 | python,windows,performance,comparison | python file copying | 0 | 1 | 1 | 3,324,905 | 1 |
0 | 0 | I'm a developer on a software project for Linux that uses Python and PyGTK. The program we are writing depends on a number of third-party packages that are available through all mayor distro repositories. One of these is a python binding (written in C) that allows our program to chat with a common C library. Unfortunately, there's a bug in the bindings that affects our program a great deal. A fix/patch was recently presented, but hasn't been committed yet. We want to include this fix as soon as possible, but are unsure that the best course of action would be.
Based on the scenario I described, we figured we have the following options. Hopefully someone can give more insight or maybe point us to a solution we haven't considered yet
Wait for the python bindings to be updated. The problem with this is that we have no way of knowing when the update would be accepted into distribution repositories, or even if it will be backported to earlier releases.
Include a modified version of the python bindings including the fix with our program and have users compile it on installation. This would provide a burden for packagers as every version of every distribution would link against another version of the C library.
Rewrite our program in C++ and avoid dealing with python bindings all together. Yep, actually considering this hehe.
Keep the ugly hack we have in place intact. Not preferable obviously as it is, well, an ugly hack
Thanks in advance! | false | 3,325,161 | 0.53705 | 0 | 0 | 3 | As long as the ugly hack works, use it. It will have drawbacks local to your package. Additionally, you can phase it out (significantly) later by requiring a bug-free version of your dependency, when it is released and is available for some time so that distros have a chance to start shipping it. | 0 | 115 | 0 | 2 | 2010-07-24T12:54:00.000 | python,linux,repository,packaging | Bug in third-party dependency creates python packaging dilemma | 0 | 1 | 1 | 3,325,182 | 1 |
0 | 0 | I know how to make an image a button in Tkinter, now how do I make th image a toggle button similar to a radio button? | true | 3,327,799 | 1.2 | 0 | 0 | 2 | Use a checkbutton with "indicatoron" set to False. This will turn off the little checkbox so you only see the image (or text), and the relief will toggle between raised and sunken each time it is clicked.
Another way is to use a label widget and manage the button clicks yourself. Add a binding for <1> and change the relief to sunken if raised, and raised if sunken. It's easier to use the built-in features of the checkbutton, since it also handles keyboard traversal, activation, etc. | 0 | 1,795 | 0 | 0 | 2010-07-25T02:49:00.000 | python,radio-button,toggle,tkinter | Making a Toggle Button with an image in Tkinter | 0 | 1 | 2 | 3,327,963 | 1 |
0 | 0 | I have a gtk TextView in a maximized window and I want to know how many characters a line can fit before you have to scroll. | false | 3,328,241 | 0 | 0 | 0 | 0 | (Friendly reminder, please stop putting answers in the comments, people.)
To summarize:
It depends on the size of the TextView, size of the window, size of the font, and as Alex Martelli said, the particular font and the usage of letters..."i" is a narrow letter, "m" is a wide letter, thus you can fit more "i"s than you can "m"s in a given space.
So, in short, there is no way to know for sure. | 0 | 214 | 0 | 0 | 2010-07-25T06:03:00.000 | python,gtk,pygtk | Get the length in characters of a PyGTK TextView | 0 | 1 | 1 | 8,647,405 | 1 |
0 | 0 | What are the usable tools?
I am aware of wxformbuilder and wxGlade, but none of them seems to be complete yet. | false | 3,329,762 | 0.132549 | 0 | 0 | 2 | Here are a few of the most popular wxPython related GUI builders:
Boa Constructor (mostly dead)
wxGlade
wxFormBuilder
XRCed
wxDesigner (not FOSS)
Dabo - one of their videos shows a way to interactively design an app...
I personally just use a Python IDE to hand code my applications. My current favorite IDE is Wing. | 0 | 831 | 0 | 2 | 2010-07-25T15:30:00.000 | python,wxpython,wxwidgets | What are the existing open-source Python WxWidgets designers? | 0 | 2 | 3 | 3,345,554 | 1 |
0 | 0 | What are the usable tools?
I am aware of wxformbuilder and wxGlade, but none of them seems to be complete yet. | false | 3,329,762 | 0.066568 | 0 | 0 | 1 | afaik... none. I'll follow the answers to see if someone has one and try it of course but I'm not convinced this will be THAT useful. When using wxPython, you usually work with sizers (at least I think the results are better) so you don't really need to "place" the controls on the frame and I think a GUI "design" would be longer to do. The only part where I think it could have some interest is to fill atributes for the controls but a good auto-complete with wx (or a good cheat sheet or a "template class" with all the options you use) solves the problem in my opinion. I stopped seeking for a GUI designer for wx after trying Pydev that auto-completes wx very nicely (a lot better than everything I tried before... and that's a lot!). | 0 | 831 | 0 | 2 | 2010-07-25T15:30:00.000 | python,wxpython,wxwidgets | What are the existing open-source Python WxWidgets designers? | 0 | 2 | 3 | 3,330,832 | 1 |
0 | 0 | I am new to this post as well as to python GUI programming.I want to make a realtime graphical GUI in wxpython.My requirement is that i have to catch signals from a device and i have to display the data in graphical as well as in textual form.The system should be accurate and be specific with the time constraints.Please can any one guide me in this,and if this be possible in wxpython and if yes how can i and if no what i can use for this is python.
Hoping someone will help me out soon.Thanks in advance and for your concern.
regards,
Anil ph | false | 3,332,263 | 0 | 0 | 0 | 0 | If you can connect to this mysterious device and receive data from it from Python, then you can display said data with wxPython or any other GUI toolkit. You don't really say what kind of data it is or what you want to display? Lines? Graphs? Or what? If it's just tabular data, use the wx.ListCtrl (or ObjectListView) widget. If you need graphs, see the Plot widget or Matplotlib. | 0 | 179 | 0 | 0 | 2010-07-26T04:48:00.000 | user-interface,wxpython,real-time | Help : Realtime graphical interface in wxpython | 0 | 1 | 1 | 5,598,605 | 1 |
0 | 0 | I have an application where my DataFetch() class "Wraps" around my HBHTray() class for the purpose of interacting with the functions/variables of that class. Unfortunately, I can't seem to be able to get the code to continue execution after my DataFetch() class makes a instance of HBHTray and calls it, and on the Start() method of HBHTray it hangs.
This is the relevant code:
class DataFetch(): # I need the DataFetch class to be wrapping around HBHTray so I can call/edit certain variables from within functions in DataFetch
def init(self):
self.Interval, self.Username, self.Password, self.CheckShoutBox = GetOptions('.tray')
self.Gui = HBHTray()
print '1'
self.Gui.Start()
print '2'
def Login(self):
pass # Do stuff (Eg: Edit self.Gui.StatusIcon state or call self.Gui.Notify()
def Start(self):
print 'hi!'
sleep(self.Interval)
print 'Hi!'
class HBHTray():
def init(self):
self.StatusIcon = gtk.StatusIcon()
self.StatusIcon.set_from_file('img')
self.StatusIcon.set_tooltip('No new messages')
self.Menu = gtk.Menu()
self.CheckBox = gtk.CheckMenuItem('Notify')
self.CheckBox.connect('activate', self.ChangeCheckBox)
self.CheckBox.set_active(True)
self.Menu.append(self.CheckBox)
self.MenuItem = gtk.ImageMenuItem('Options')
self.MenuItem.connect('activate', self.Options, self.StatusIcon)
self.Menu.append(self.MenuItem)
self.MenuItem = gtk.ImageMenuItem('About')
self.MenuItem.connect('activate', self.About, self.StatusIcon)
self.Menu.append(self.MenuItem)
self.MenuItem = gtk.ImageMenuItem('Quit')
self.MenuItem.connect('activate', self.Quit, self.StatusIcon)
self.Menu.append(self.MenuItem)
self.StatusIcon.connect('popup-menu', self.PopMenu, self.Menu)
self.StatusIcon.set_visible(1)
def PopMenu(self, widget, button, time, data = None):
if data:
data.show_all()
data.popup(None, None, gtk.status_icon_position_menu, 3, time, self.StatusIcon)
def Notify(self, message):
pynotify.init('null')
notification = pynotify.Notification('Something', message, 'dialogue')
notification.attach_to_status_icon(self.StatusIcon)
notification.show()
def Start(self):
gtk.main()
def About(self, a, b):
self.Notify('test')
def Options(self, a, b):
print a, b
def ChangeCheckBox(self, null):
pass
def Quit(self, a, b):
raise SystemExit
if name == 'main':
try:
gobject.threads_init() # Doesn't work?
Monitor = DataFetch()
Monitor.Start()
Sorry for the terrible formatting, Stack Overflow doesn't seem to like blank lines....
Anyways, though, "1" is printed, but "2" is not. So, gtk.main() is obviously where it's hanging. Is there any way to allow me to continue execution and have gtk go do it's own thing? | true | 3,336,457 | 1.2 | 0 | 0 | 0 | Turns out the problem was that I couldn't find a working solution because I was utilizing the Thread module the wrong way and calling run() directly when I should have been calling start(). Because of that, I was thinking that nothing I did worked (especially with no error or complaint from anything) and figured it was a problem relating to how I was wrapping gtk.main() | 0 | 356 | 0 | 0 | 2010-07-26T15:42:00.000 | python,multithreading,pygtk,wrapper | Continuing code execution after a pygtk.main() in python | 0 | 2 | 2 | 3,337,085 | 1 |
0 | 0 | I have an application where my DataFetch() class "Wraps" around my HBHTray() class for the purpose of interacting with the functions/variables of that class. Unfortunately, I can't seem to be able to get the code to continue execution after my DataFetch() class makes a instance of HBHTray and calls it, and on the Start() method of HBHTray it hangs.
This is the relevant code:
class DataFetch(): # I need the DataFetch class to be wrapping around HBHTray so I can call/edit certain variables from within functions in DataFetch
def init(self):
self.Interval, self.Username, self.Password, self.CheckShoutBox = GetOptions('.tray')
self.Gui = HBHTray()
print '1'
self.Gui.Start()
print '2'
def Login(self):
pass # Do stuff (Eg: Edit self.Gui.StatusIcon state or call self.Gui.Notify()
def Start(self):
print 'hi!'
sleep(self.Interval)
print 'Hi!'
class HBHTray():
def init(self):
self.StatusIcon = gtk.StatusIcon()
self.StatusIcon.set_from_file('img')
self.StatusIcon.set_tooltip('No new messages')
self.Menu = gtk.Menu()
self.CheckBox = gtk.CheckMenuItem('Notify')
self.CheckBox.connect('activate', self.ChangeCheckBox)
self.CheckBox.set_active(True)
self.Menu.append(self.CheckBox)
self.MenuItem = gtk.ImageMenuItem('Options')
self.MenuItem.connect('activate', self.Options, self.StatusIcon)
self.Menu.append(self.MenuItem)
self.MenuItem = gtk.ImageMenuItem('About')
self.MenuItem.connect('activate', self.About, self.StatusIcon)
self.Menu.append(self.MenuItem)
self.MenuItem = gtk.ImageMenuItem('Quit')
self.MenuItem.connect('activate', self.Quit, self.StatusIcon)
self.Menu.append(self.MenuItem)
self.StatusIcon.connect('popup-menu', self.PopMenu, self.Menu)
self.StatusIcon.set_visible(1)
def PopMenu(self, widget, button, time, data = None):
if data:
data.show_all()
data.popup(None, None, gtk.status_icon_position_menu, 3, time, self.StatusIcon)
def Notify(self, message):
pynotify.init('null')
notification = pynotify.Notification('Something', message, 'dialogue')
notification.attach_to_status_icon(self.StatusIcon)
notification.show()
def Start(self):
gtk.main()
def About(self, a, b):
self.Notify('test')
def Options(self, a, b):
print a, b
def ChangeCheckBox(self, null):
pass
def Quit(self, a, b):
raise SystemExit
if name == 'main':
try:
gobject.threads_init() # Doesn't work?
Monitor = DataFetch()
Monitor.Start()
Sorry for the terrible formatting, Stack Overflow doesn't seem to like blank lines....
Anyways, though, "1" is printed, but "2" is not. So, gtk.main() is obviously where it's hanging. Is there any way to allow me to continue execution and have gtk go do it's own thing? | false | 3,336,457 | 0 | 0 | 0 | 0 | gobject.threads_init() does not magically put your things into separate threads. It only tells the library that you're going to use threads, and sets up some locking. You'll still have to create the threads yourself. | 0 | 356 | 0 | 0 | 2010-07-26T15:42:00.000 | python,multithreading,pygtk,wrapper | Continuing code execution after a pygtk.main() in python | 0 | 2 | 2 | 3,336,490 | 1 |
0 | 0 | I'm thinking of making some kind of experimental IDE for digital hardware design. So I can't decide witch platform to choose.
I'm going to have text-editor with syntax highlighting, some vector graphics and lots of tabbed windows.
My goals:
1. to make GUI using as less custom components as possible.
2. to make it as cross-platform as possible
(I know already that CPython and Jython are cross-platform-friendly, but what about IronPython+Mono?)
So - the question is about GUI - what should I choose? | false | 3,337,725 | 0.124353 | 0 | 0 | 5 | Well, Mono does not come with the base of most Linux distributions. It's not a terribly lightweight dependency either, and I think Java is considerably more likely for people to already have. Would you plan on using "Winforms" with Mono? If so, and you don't have experience with Winforms, read about what others have to say :-) The other .NET GUI toolkit is WPF, which unfortunately Mono has no plans to implement.
Jython would be better too, because you can use SWT, which renders native widgets and provides lots of layout possibilities easily. Or you can use Jython with Swing, or whatever else -- even AWT if you love ugliness.
I really like wxPython (which you can use with CPython, which is on most distros by default), because it renders good-looking native widgets in OSX, Windows and Linux (I've only seen the Gnome widgets in person). wxPython is by far the easiest to use GUI toolkit I've used -- even programatically (i.e. layout without Glade or similar). I've also used SWT, which I found quite nice, and Swing, which I personally don't really like the looks of, and Winforms, which was a nightmare to try to do even simple layouts with.
Here's a quick comparison of the existence of the interpreter/language runtime by OS
CPython
Windows - Probably not installed, and you'd have to make a non-python installer install it with your software :-P
Linux - Probably installed (Ubuntu, Gentoo and RedHat all have system tools that are written in Python and run on CPython)
Mac - Preinstalled on OSX
Jython
Windows - Probably installed at some point in my experience, though it doesn't come with
Linux - Probably installed, but more importantly nobody would hate you for depending on it like Mono
Mac - Preinstalled on OSX ("Mac OS X Leopard comes with J2SE 5.0 preinstalled, based on JDK 1.5.0_13_b05" -- Apple's site)
IronPython
Windows - Will probably run fine because I bet most people have at the very least .NET 2.0 if they have a recent version of Windows
Linux - Probably not installed -- the only application with which I've used Mono on Linux was Rasterbator, which worked well but I felt weird putting .NET on Linux
Mac - See above
I would choose a GUI toolkit first, since that will very much impact the user experience and overall difficulty (I would choose wxPython but SWT would be a close second) then consider the above as well maybe as a tiebreaker. | 1 | 6,247 | 0 | 9 | 2010-07-26T18:19:00.000 | python,user-interface,ironpython,jython,cpython | CPython vs. Jython vs. IronPython for cross-platform GUI development | 0 | 5 | 8 | 3,337,830 | 1 |
0 | 0 | I'm thinking of making some kind of experimental IDE for digital hardware design. So I can't decide witch platform to choose.
I'm going to have text-editor with syntax highlighting, some vector graphics and lots of tabbed windows.
My goals:
1. to make GUI using as less custom components as possible.
2. to make it as cross-platform as possible
(I know already that CPython and Jython are cross-platform-friendly, but what about IronPython+Mono?)
So - the question is about GUI - what should I choose? | false | 3,337,725 | 0.049958 | 0 | 0 | 2 | Take a look at comparable GUI's written in python/jython/ironpython. Look for programs that you like and find out what they use. I guess most if not all will be written in cpython + gtk or cpython + qt. I think all gui toolkits in python are cross platform. | 1 | 6,247 | 0 | 9 | 2010-07-26T18:19:00.000 | python,user-interface,ironpython,jython,cpython | CPython vs. Jython vs. IronPython for cross-platform GUI development | 0 | 5 | 8 | 3,337,760 | 1 |
0 | 0 | I'm thinking of making some kind of experimental IDE for digital hardware design. So I can't decide witch platform to choose.
I'm going to have text-editor with syntax highlighting, some vector graphics and lots of tabbed windows.
My goals:
1. to make GUI using as less custom components as possible.
2. to make it as cross-platform as possible
(I know already that CPython and Jython are cross-platform-friendly, but what about IronPython+Mono?)
So - the question is about GUI - what should I choose? | false | 3,337,725 | 0.124353 | 0 | 0 | 5 | I'd say that if cross-platform is a goal, forget IronPython. A lot of people hate the dependency hell it causes so it'll be too much work to get it up in running in some OSes/distributions. Jython will suffer this also, albeit to a lesser degree. | 1 | 6,247 | 0 | 9 | 2010-07-26T18:19:00.000 | python,user-interface,ironpython,jython,cpython | CPython vs. Jython vs. IronPython for cross-platform GUI development | 0 | 5 | 8 | 3,337,744 | 1 |
0 | 0 | I'm thinking of making some kind of experimental IDE for digital hardware design. So I can't decide witch platform to choose.
I'm going to have text-editor with syntax highlighting, some vector graphics and lots of tabbed windows.
My goals:
1. to make GUI using as less custom components as possible.
2. to make it as cross-platform as possible
(I know already that CPython and Jython are cross-platform-friendly, but what about IronPython+Mono?)
So - the question is about GUI - what should I choose? | false | 3,337,725 | 0.049958 | 0 | 0 | 2 | Java is the most portable platform. Jython is written in 100% pure Java. 'Nuff said.
BTW I just switched a CPython/GTK project to Jython (trying to remove as much unmanaged code as possible), the only problem is that Jython is at 2.5 still, which kind of sucks when you're used to 2.6/2.7/3 :) | 1 | 6,247 | 0 | 9 | 2010-07-26T18:19:00.000 | python,user-interface,ironpython,jython,cpython | CPython vs. Jython vs. IronPython for cross-platform GUI development | 0 | 5 | 8 | 3,341,283 | 1 |
0 | 0 | I'm thinking of making some kind of experimental IDE for digital hardware design. So I can't decide witch platform to choose.
I'm going to have text-editor with syntax highlighting, some vector graphics and lots of tabbed windows.
My goals:
1. to make GUI using as less custom components as possible.
2. to make it as cross-platform as possible
(I know already that CPython and Jython are cross-platform-friendly, but what about IronPython+Mono?)
So - the question is about GUI - what should I choose? | false | 3,337,725 | 0.024995 | 0 | 0 | 1 | There are plenty of answers already, but I'd like to add one important thing - regardless of which library you learn, most of the principles will be the same when you move to another library.
I don't know about Qt, but for most graphics programs (in PyGTK or Tkinter) the best thing to do, as far as editing goes, is to use a PIL image (or something similar) to draw on and then draw that image on your canvas widget, otherwise you can lose pixel data if your window gets covered. | 1 | 6,247 | 0 | 9 | 2010-07-26T18:19:00.000 | python,user-interface,ironpython,jython,cpython | CPython vs. Jython vs. IronPython for cross-platform GUI development | 0 | 5 | 8 | 3,337,836 | 1 |
0 | 0 | i was wondering how to update a StaticText dynamically in wxpython?
I have a script that goes every five minutes and reads a status from a webpage, then prints using wxpython the status in a static input.
How would i dynamically, every 5 minutes update the statictext to reflect the status?
thanks alot
-soule | false | 3,339,263 | 0.099668 | 0 | 0 | 1 | Call the SetLabel method in your static text instance. So you don't run into conflict with the size, make sure your StaticText instance is created with enough space to write the future labels you'll want to write to it. | 0 | 12,769 | 0 | 5 | 2010-07-26T21:50:00.000 | python,wxpython,refresh | Dynamically update wxPython staticText | 0 | 1 | 2 | 3,339,765 | 1 |
0 | 0 | Just wondering if there is any kind of framework or method of making a Gui that will override (Stay on top of) all other windows in python. Including Games or other programs that seem to "Take over" the computers Graphical processes. Any point in the right direction would be much appreciated...
PS. The OS in question is Windows 7, but a cross platform solution would be appreciated. | false | 3,340,639 | 0 | 0 | 0 | 0 | For a cross-platform solution, you could use wxPython with a wxSTAY_ON_TOP style bit in a main window. I believe that this will give you the behavior you desire on Mac and Unix GUIs as well as Microsoft Windows ones. | 1 | 99 | 0 | 0 | 2010-07-27T03:55:00.000 | python,user-interface | GUI's Over Running Programs in python | 0 | 1 | 2 | 3,340,779 | 1 |
0 | 0 | What's a good way to handle fatal errors - missing packages, .ui files not compiled, Qt DLLs or shared objects not found, etc. - in a PyQt app (or other Python app)?
Displaying a cross-platform message box without Qt DLLs or shared objects seems like a lot of work. Dumping a message to the console seems not very helpful, since the end user will likely not see the console. How do other Python apps handle this? Or do they simply assume that a properly installed app won't run into these problems? | true | 3,358,759 | 1.2 | 0 | 0 | 1 | The distutils model handles installing a python app correctly, or there is a third party setuptools package that is even easier for end users. | 1 | 67 | 0 | 0 | 2010-07-29T01:04:00.000 | python,installation,error-handling,pyqt,packages | Handling missing packages or DLLs in a PyQt app | 0 | 1 | 1 | 3,358,864 | 1 |
0 | 0 | I was wondering how to hide/delete a StaticText in wxPython? | false | 3,367,986 | 0 | 0 | 0 | 0 | statictext.Show to show
and
statictext.Hide to hide | 0 | 3,670 | 0 | 4 | 2010-07-30T00:37:00.000 | python,wxpython,hide | Hide/Delete a StaticText in wxPython | 0 | 3 | 3 | 22,358,518 | 1 |
0 | 0 | I was wondering how to hide/delete a StaticText in wxPython? | true | 3,367,986 | 1.2 | 0 | 0 | 5 | Have you tried control.Hide() or control.Show(False)? | 0 | 3,670 | 0 | 4 | 2010-07-30T00:37:00.000 | python,wxpython,hide | Hide/Delete a StaticText in wxPython | 0 | 3 | 3 | 3,368,074 | 1 |
0 | 0 | I was wondering how to hide/delete a StaticText in wxPython? | false | 3,367,986 | 0.321513 | 0 | 0 | 5 | The widget's Hide/Show methods should work. If the widget is in a sizer, then you can use the sizer's Detach method to "hide" it but not destroy it. Otherwise, the sizer has a Remove method that will remove the widget and destroy it. And there's the widget's own Destroy method. | 0 | 3,670 | 0 | 4 | 2010-07-30T00:37:00.000 | python,wxpython,hide | Hide/Delete a StaticText in wxPython | 0 | 3 | 3 | 3,371,640 | 1 |
1 | 0 | Are there any examples how to authenticate your desktop Facebook application using PyQT and embedded webkit?
This is to provide better user experience than opening Facebook authentication page in a separate browser window. | true | 3,371,549 | 1.2 | 0 | 0 | 0 | I don't believe you can open an "authentication page" in a separate window under Facebook's terms (I used to work for Zynga, and we couldn't then, so I don't know how you'd achieve this now legally).
Second, you're looking into the QWebkit backwards I believe. From a UI perspective this is supposed to provide access to websites, and interact with them. If you want a good looking page, with all the bells and whistle, it pains me to say it ~ but use Actionscript 3, or Ajax and it's bundle.
This post would probably be answered better if tagged in the javascript, php, and as3 sections. As the php guys will know the correct hacks to get your intended result, if possible | 0 | 640 | 0 | 4 | 2010-07-30T12:51:00.000 | python,facebook,webkit,pyqt | pyqt, webkit and facebook authentication? | 0 | 1 | 1 | 5,099,848 | 1 |
0 | 0 | i have a scene with a multiple (QGraphicsTextItem)s, and i need to have control over their colors , so how to change a color of a QGraphicsTextItem ? is it possible anyway? i've been trying for 3 days until now . please help
thanks in advance | false | 3,377,439 | 0.197375 | 0 | 0 | 2 | setDefaultTextColor(col) "Sets the color for unformatted text to col." The documentation is not clear about what "unformatted text" means. I think it means: "all portions of the contents of the item that have not been styled."
The contents is a QTextDocument.
You style a part of a document using a QTextCursor. You can't style the QTextDocument per se, only a part that is selected by a QTextCursor (but you can select the whole document.)
You can style a QTextCursor using method mergeCharFormat(QTextCharFormat)
The QTextCharFormat has methods:
foreground().setColor(QColor)
setForeground(QBrush)
setTextOutline(QPen)
Foreground is a QBrush that paints several things including "text" (but better said: the fill of characters?)
One nuance is that certain newly constructed QBrush have (default to) QBrushStyle.NoBrush, which is transparent, even if you setColor(). | 0 | 8,684 | 0 | 10 | 2010-07-31T08:52:00.000 | python,qt,qt4,pyqt | how to change the color of a QGraphicsTextItem | 0 | 1 | 2 | 12,565,371 | 1 |
0 | 0 | I have a WxPython app that, among other things, has a integrated file-browser.
I want to be able to create a system-default file context menu (e.g. what you get if you right-click on a file in windows explorer) when a user right clicks on one of the items within my application.
Note: I already know how to create my own context menu (e.g. wx.EVT_LIST_ITEM_RIGHT_CLICK), I want the Windows context menu.
To clarify, I do not want, or need to modify the existing system context menu, I want to be able to display it for a specific file within my application.
Basically, I know what was right clicked on, and where the mouse pointer is (if it's needed). I want to create the system context menu there, just like it works in windows explorer. | false | 3,380,986 | 0 | 0 | 0 | 0 | If you have python win32 installed, then look under the directory <PYTHON>/lib/site-packages/win32comext/shell/demos/servers. This contains a file context_menu.py which has sample code for creating a shell extension.
Update: I think you want the folder_view.py sample. | 0 | 741 | 0 | 0 | 2010-08-01T06:20:00.000 | python,user-interface,windows-xp,wxpython | Create Explorer.exe's File - Context Menu in WxPython application | 0 | 1 | 1 | 3,380,995 | 1 |
0 | 0 | I hope to load .net dll in ironpython.
But one of static functions in .net dll, has some Named and Optional Arguments.
like, Draw(weight:w,height:h, Area=1)
Only can I use full arguments? | true | 3,384,989 | 1.2 | 0 | 0 | 6 | Named and optional parameters are fully supported. .NET has had these for a long time for VB.NET support and so IronPython has supported that same way to do them since the beginning. The new C# syntax maps to the same underlying metadata as the old VB support.
For calling you use f(x = 42) which is Python's named parameter syntax. For optional parameters you can just leave them out. In your example case you can probably do Draw(weight, height) and leave Area out. Or you can call w/ weight and height as named parameters and leave Area out.
The underlying .NET meta data that IronPython looks for is either the OptionalAttribute or DefaultParameterValueAttribute. For optional we pass in default(T) unless the type is object in which case we pass in Missing.Value. This generally matches how reflection calls these APIs as well. | 1 | 1,159 | 0 | 3 | 2010-08-02T04:28:00.000 | .net,ironpython,optional-parameters,named-parameters | Can I use Named and Optional Arguments in ironpython | 0 | 1 | 2 | 3,401,635 | 1 |
0 | 0 | Im planing to do some GUI development using pyqt4 pykde and python3.1 on Kubuntu 10.4. In the research I did I found out that most of the things are available as packages in repositories and some of the packages are preinstalled. Only thing is I'm not able to figure out what to install and what not to. Can someone please give me a list of packages that I need to install to do GUI development using python3.1 pyQt4 and pyKDE. | false | 3,385,013 | 0 | 0 | 0 | 0 | I guess you need python-qt4 qt4-designer qt4-dev-tools. | 1 | 333 | 0 | 2 | 2010-08-02T04:35:00.000 | python,linux,pyqt4,kubuntu | pyqt installation question | 0 | 1 | 2 | 3,460,599 | 1 |
0 | 0 | I'm working on a project using Tkinter and Python. In order to have native theming and to take advantage of the new widgets I'm using ttk in Python 2.6. My problem is how to allow the user to scroll through the tabs in the notebook widget (a la firefox). Plus, I need a part in the right edge of the tabs for a close button. The frame for the active tab would need to fill the available horizontal space (including under the scroll arrows).
I thought I could do this using the Place geometry manager, but I was wondering if there was a better way? The ttk python docs don't have any methods to deal with this that I could see.
Edit: looks like there are difficulties for even trying to implement this using place. For one, I'd still need the tabs to scroll and the active panel to stay in the one place. | false | 3,386,098 | 0 | 0 | 0 | 0 | I've never used these widgets so I have no idea how possible this is, but what I would try is something akin to the grid_remove() method. If you can move the tabs to an invisible widget, or just make them invisible without losing content, that's what I'd look for/try. | 0 | 1,350 | 0 | 1 | 2010-08-02T08:20:00.000 | python,user-interface,tkinter,ttk | Using the ttk (tk 8.5) Notebook widget effectively (scrolling of tabs) | 0 | 2 | 2 | 3,389,225 | 1 |
0 | 0 | I'm working on a project using Tkinter and Python. In order to have native theming and to take advantage of the new widgets I'm using ttk in Python 2.6. My problem is how to allow the user to scroll through the tabs in the notebook widget (a la firefox). Plus, I need a part in the right edge of the tabs for a close button. The frame for the active tab would need to fill the available horizontal space (including under the scroll arrows).
I thought I could do this using the Place geometry manager, but I was wondering if there was a better way? The ttk python docs don't have any methods to deal with this that I could see.
Edit: looks like there are difficulties for even trying to implement this using place. For one, I'd still need the tabs to scroll and the active panel to stay in the one place. | true | 3,386,098 | 1.2 | 0 | 0 | 2 | The notebook widget doesn't do scrolling of tabs (or multiple layers of them either) because the developer doesn't believe that they make for a good GUI. I can see his point; such GUIs tend to suck. The best workaround I've seen is to have a panel on the side that allows the selection of which pane to display. You can then apply tricks to that panel to manage the amount of information there (e.g., by making it a treeview widget and holding the info hierarchically, much like most email clients handle mail folders; treeview widgets are scrollable). | 0 | 1,350 | 0 | 1 | 2010-08-02T08:20:00.000 | python,user-interface,tkinter,ttk | Using the ttk (tk 8.5) Notebook widget effectively (scrolling of tabs) | 0 | 2 | 2 | 3,650,157 | 1 |
0 | 0 | I'm working for small company, which operates in the automation industry.
The boss hired me because he wants to sell/give some desktop applications to his
current costumers.
He imposes me to use the Netbeans Platform (a generic desktop application framework).
A software engineer friend of his advised him to choose this framework.
At the moment I created 3 desktop applications with Netbeans Platform.
I like Netbeans Platfom. I really take advantage of modularity, Window System and Lookup.
Unfortunately I'm frustrated to known that I can do the same works with Python and PyQt in a fraction of time.
I've already illustrated to my boss the main advantages of Python, but he doesn't like the
idea to use a language that he never heared of it.
I'm the only programmer who codes desktop applications. And except the framework imposition, I'm free to use whatever I want.
I'm looking for good motivations to convince him to leave Netbeans Platform for Python/PyQt.
P.S: My english is bad, sorry. | false | 3,386,377 | 0.066568 | 0 | 0 | 3 | First, results speak for themselves: if you can piece together another version of one of your applications in pyqt, and tell him how long it took, it might be motivation enough.
Or, next time you're starting a project, you could prototype four or five different versions of the interface in pyqt in the morning, ask his feedback after lunch, and then say, "if I keep going on these, it'll be done in two days; if I redo this in netbeans, it'll be done in four."
And as for the "never heard of it", feel free to point out that Google uses python extensively, and even hired many of the python developers. | 0 | 874 | 0 | 5 | 2010-08-02T09:07:00.000 | java,python,netbeans,pyqt | How to convince boss to substitute Java/Netbeans Platform for Python/PyQt? | 0 | 9 | 9 | 3,386,409 | 1 |
0 | 0 | I'm working for small company, which operates in the automation industry.
The boss hired me because he wants to sell/give some desktop applications to his
current costumers.
He imposes me to use the Netbeans Platform (a generic desktop application framework).
A software engineer friend of his advised him to choose this framework.
At the moment I created 3 desktop applications with Netbeans Platform.
I like Netbeans Platfom. I really take advantage of modularity, Window System and Lookup.
Unfortunately I'm frustrated to known that I can do the same works with Python and PyQt in a fraction of time.
I've already illustrated to my boss the main advantages of Python, but he doesn't like the
idea to use a language that he never heared of it.
I'm the only programmer who codes desktop applications. And except the framework imposition, I'm free to use whatever I want.
I'm looking for good motivations to convince him to leave Netbeans Platform for Python/PyQt.
P.S: My english is bad, sorry. | false | 3,386,377 | 0 | 0 | 0 | 0 | Just use Netbeans as an IDE and he'll never notice :P
Speaking more seriously: a side by side comparison of strong and weak points behind each of technologies will certianly be more convincing. Just don't cheat too much in favor of Python ;) | 0 | 874 | 0 | 5 | 2010-08-02T09:07:00.000 | java,python,netbeans,pyqt | How to convince boss to substitute Java/Netbeans Platform for Python/PyQt? | 0 | 9 | 9 | 3,386,403 | 1 |
0 | 0 | I'm working for small company, which operates in the automation industry.
The boss hired me because he wants to sell/give some desktop applications to his
current costumers.
He imposes me to use the Netbeans Platform (a generic desktop application framework).
A software engineer friend of his advised him to choose this framework.
At the moment I created 3 desktop applications with Netbeans Platform.
I like Netbeans Platfom. I really take advantage of modularity, Window System and Lookup.
Unfortunately I'm frustrated to known that I can do the same works with Python and PyQt in a fraction of time.
I've already illustrated to my boss the main advantages of Python, but he doesn't like the
idea to use a language that he never heared of it.
I'm the only programmer who codes desktop applications. And except the framework imposition, I'm free to use whatever I want.
I'm looking for good motivations to convince him to leave Netbeans Platform for Python/PyQt.
P.S: My english is bad, sorry. | true | 3,386,377 | 1.2 | 0 | 0 | 12 | If your selling skills are not working in discussion format I highly suggest that you document it. Some managers/bosses really respond well to this.
Make a matrix of all the metrics that you yourself use to grade the two frameworks (I leave the level of objectivity to you there: for example if objective it should analyze the cost of transition and the loss of institutional experience; but it might not be high).
Finally, send it by e-mail and viola you have:
made a report/analysis of the situation providing options for improvement
this shows that you are thinking towards future and that you show initiative
EDIT:
You can also ask your boss to show your analysis to his friend if he trust his friend that much, but ask for a written counter-analysis so that you can address the critique.
It is a good thing to do it openly and document the decision process well, since ultimately, if your suggestion is accepted, you will share responsibility for the decision. | 0 | 874 | 0 | 5 | 2010-08-02T09:07:00.000 | java,python,netbeans,pyqt | How to convince boss to substitute Java/Netbeans Platform for Python/PyQt? | 0 | 9 | 9 | 3,386,436 | 1 |
0 | 0 | I'm working for small company, which operates in the automation industry.
The boss hired me because he wants to sell/give some desktop applications to his
current costumers.
He imposes me to use the Netbeans Platform (a generic desktop application framework).
A software engineer friend of his advised him to choose this framework.
At the moment I created 3 desktop applications with Netbeans Platform.
I like Netbeans Platfom. I really take advantage of modularity, Window System and Lookup.
Unfortunately I'm frustrated to known that I can do the same works with Python and PyQt in a fraction of time.
I've already illustrated to my boss the main advantages of Python, but he doesn't like the
idea to use a language that he never heared of it.
I'm the only programmer who codes desktop applications. And except the framework imposition, I'm free to use whatever I want.
I'm looking for good motivations to convince him to leave Netbeans Platform for Python/PyQt.
P.S: My english is bad, sorry. | false | 3,386,377 | 0.022219 | 0 | 0 | 1 | Perhaphs showing him
a)Time spent in developing in Python and Java
b)lines of code in Python and Java
with these two metrics maybe you can make your case stronger | 0 | 874 | 0 | 5 | 2010-08-02T09:07:00.000 | java,python,netbeans,pyqt | How to convince boss to substitute Java/Netbeans Platform for Python/PyQt? | 0 | 9 | 9 | 3,386,699 | 1 |
0 | 0 | I'm working for small company, which operates in the automation industry.
The boss hired me because he wants to sell/give some desktop applications to his
current costumers.
He imposes me to use the Netbeans Platform (a generic desktop application framework).
A software engineer friend of his advised him to choose this framework.
At the moment I created 3 desktop applications with Netbeans Platform.
I like Netbeans Platfom. I really take advantage of modularity, Window System and Lookup.
Unfortunately I'm frustrated to known that I can do the same works with Python and PyQt in a fraction of time.
I've already illustrated to my boss the main advantages of Python, but he doesn't like the
idea to use a language that he never heared of it.
I'm the only programmer who codes desktop applications. And except the framework imposition, I'm free to use whatever I want.
I'm looking for good motivations to convince him to leave Netbeans Platform for Python/PyQt.
P.S: My english is bad, sorry. | false | 3,386,377 | 0.110656 | 0 | 0 | 5 | The basic problem here is that your non-technical boss is getting conflicting advice from you and from the friend who advised him in the first place. If you want him to take your advice seriously you need to prove that your advice is likely to be trustworthy. And that will only come with taking the lead and being successful with significant projects in the company. Right now, you haven't earned his confidence.
The other thing to consider is how your preferences mesh with the company's objectives. For instance, you want to be able to write code fast. But the boss / the company needs code that is going to be reliable and maintainable ... if you decide to take another position. He doesn't want to be left in the awkward situation where the company is contractually committed to deliver code that doesn't really work properly, and the only person who understands it has left. | 0 | 874 | 0 | 5 | 2010-08-02T09:07:00.000 | java,python,netbeans,pyqt | How to convince boss to substitute Java/Netbeans Platform for Python/PyQt? | 0 | 9 | 9 | 3,386,477 | 1 |
0 | 0 | I'm working for small company, which operates in the automation industry.
The boss hired me because he wants to sell/give some desktop applications to his
current costumers.
He imposes me to use the Netbeans Platform (a generic desktop application framework).
A software engineer friend of his advised him to choose this framework.
At the moment I created 3 desktop applications with Netbeans Platform.
I like Netbeans Platfom. I really take advantage of modularity, Window System and Lookup.
Unfortunately I'm frustrated to known that I can do the same works with Python and PyQt in a fraction of time.
I've already illustrated to my boss the main advantages of Python, but he doesn't like the
idea to use a language that he never heared of it.
I'm the only programmer who codes desktop applications. And except the framework imposition, I'm free to use whatever I want.
I'm looking for good motivations to convince him to leave Netbeans Platform for Python/PyQt.
P.S: My english is bad, sorry. | false | 3,386,377 | 0.022219 | 0 | 0 | 1 | I would guess a lot, in terms of risk management, would depend on the separation/isolation of the various softwares you develop, and their life cycle.
If you don't need to further a central set of libraries, or have (or can develop) Python bindings for those, and the projects are relatively self contained, say a turn around of two to six months, you could give him a quote for a project in Java that is reasonable and he's familiar with (to make sure it doesn't appear artificially inflated). Then give a much reduced quote for the same in py+pyQt, and see if you can get him to invest on your advice.
Without tangible evidence coming from inside that a change in route will bring benefit the more management and economics savvy people who are technically ignorant will not buy into a new platform when the old one never prevented from realizing and selling.
Without a decent assessment of why he doesn't want to switch platform and what he considers risks it's kinda hard to give more pertinent advice. | 0 | 874 | 0 | 5 | 2010-08-02T09:07:00.000 | java,python,netbeans,pyqt | How to convince boss to substitute Java/Netbeans Platform for Python/PyQt? | 0 | 9 | 9 | 3,387,150 | 1 |
0 | 0 | I'm working for small company, which operates in the automation industry.
The boss hired me because he wants to sell/give some desktop applications to his
current costumers.
He imposes me to use the Netbeans Platform (a generic desktop application framework).
A software engineer friend of his advised him to choose this framework.
At the moment I created 3 desktop applications with Netbeans Platform.
I like Netbeans Platfom. I really take advantage of modularity, Window System and Lookup.
Unfortunately I'm frustrated to known that I can do the same works with Python and PyQt in a fraction of time.
I've already illustrated to my boss the main advantages of Python, but he doesn't like the
idea to use a language that he never heared of it.
I'm the only programmer who codes desktop applications. And except the framework imposition, I'm free to use whatever I want.
I'm looking for good motivations to convince him to leave Netbeans Platform for Python/PyQt.
P.S: My english is bad, sorry. | false | 3,386,377 | 0.022219 | 0 | 0 | 1 | Have you emphasised the point of the lower development time. Any person that doesn't want a shorter turn around time is an idiot. This is the only main issue i can think for the change. Or what you could do is develop it on the side and when you have errors say this is what i have been doing in my spare time(have a working copy written in python). | 0 | 874 | 0 | 5 | 2010-08-02T09:07:00.000 | java,python,netbeans,pyqt | How to convince boss to substitute Java/Netbeans Platform for Python/PyQt? | 0 | 9 | 9 | 3,386,396 | 1 |
0 | 0 | I'm working for small company, which operates in the automation industry.
The boss hired me because he wants to sell/give some desktop applications to his
current costumers.
He imposes me to use the Netbeans Platform (a generic desktop application framework).
A software engineer friend of his advised him to choose this framework.
At the moment I created 3 desktop applications with Netbeans Platform.
I like Netbeans Platfom. I really take advantage of modularity, Window System and Lookup.
Unfortunately I'm frustrated to known that I can do the same works with Python and PyQt in a fraction of time.
I've already illustrated to my boss the main advantages of Python, but he doesn't like the
idea to use a language that he never heared of it.
I'm the only programmer who codes desktop applications. And except the framework imposition, I'm free to use whatever I want.
I'm looking for good motivations to convince him to leave Netbeans Platform for Python/PyQt.
P.S: My english is bad, sorry. | false | 3,386,377 | 1 | 0 | 0 | 8 | The problem is that development time is usually nothing compared to maintenance. Who cares if it takes two days instead of four if the app has a 1-5 year lifetime?
You'll have to convince him that if you get hit by a truck or leave the company (perhaps to work for somebody who uses Python exclusively) that he won't be left in the lurch with a bunch of applications that nobody else knows and can't maintain or upgrade. | 0 | 874 | 0 | 5 | 2010-08-02T09:07:00.000 | java,python,netbeans,pyqt | How to convince boss to substitute Java/Netbeans Platform for Python/PyQt? | 0 | 9 | 9 | 3,386,487 | 1 |
0 | 0 | I'm working for small company, which operates in the automation industry.
The boss hired me because he wants to sell/give some desktop applications to his
current costumers.
He imposes me to use the Netbeans Platform (a generic desktop application framework).
A software engineer friend of his advised him to choose this framework.
At the moment I created 3 desktop applications with Netbeans Platform.
I like Netbeans Platfom. I really take advantage of modularity, Window System and Lookup.
Unfortunately I'm frustrated to known that I can do the same works with Python and PyQt in a fraction of time.
I've already illustrated to my boss the main advantages of Python, but he doesn't like the
idea to use a language that he never heared of it.
I'm the only programmer who codes desktop applications. And except the framework imposition, I'm free to use whatever I want.
I'm looking for good motivations to convince him to leave Netbeans Platform for Python/PyQt.
P.S: My english is bad, sorry. | false | 3,386,377 | 0.044415 | 0 | 0 | 2 | Some people will tell you to try to convince your boss verbally. Others will tell you to document the time savings you think you can make. My opinion is that you just go ahead and do it. Do it in your own time if you strongly believe its in your best interests.
I'm yet to meet a software manager who turned down a working piece of software when it comes in on time and under budget. This is by far the best method of persuasion I've used in my career. Its also a great way to show you have initiative. Just be prepared to work for free if it doesnt work out. | 0 | 874 | 0 | 5 | 2010-08-02T09:07:00.000 | java,python,netbeans,pyqt | How to convince boss to substitute Java/Netbeans Platform for Python/PyQt? | 0 | 9 | 9 | 3,387,872 | 1 |
0 | 0 | HI all
I am trying to use SWIG to export C++ code to Python.
The C sample I read on the web site does work but I have problem with C++ code.
Here are the lines I call
swig -c++ -python SWIG_TEST.i
g++ -c -fPIC SWIG_TEST.cpp SWIG_TEST_wrap.cxx -I/usr/include/python2.4/
gcc --shared SWIG_TEST.o SWIG_TEST_wrap.o -o _SWIG_TEST.so -lstdc++
When I am finished I receive the following error message
ImportError: ./_SWIG_TEST.so: undefined symbol: Py_InitModule4
Do you know what it is? | true | 3,387,663 | 1.2 | 1 | 0 | 4 | It looks like you aren't linking to the Python runtime library. Something like adding -lpython24 to your gcc line. (I don't have a Linux system handy at the moment). | 0 | 886 | 0 | 2 | 2010-08-02T12:20:00.000 | c++,python,swig | using SWIG with C++ | 0 | 1 | 3 | 3,393,617 | 1 |
0 | 0 | I'd like to implement my own key command. However when I do, it does both what I tell it and the default command. How do I disable the default command, so that my command is the only one that runs?
This is on Windows 7, BTW. | true | 3,400,622 | 1.2 | 0 | 0 | 2 | Put return 'break' at the end of your event handling function. This tells Tkinter not to propagate the event to default handlers. | 0 | 226 | 0 | 0 | 2010-08-03T20:44:00.000 | python,windows,keyboard-shortcuts,tkinter | How do I disable default Tkinter key commands? | 0 | 1 | 1 | 3,401,235 | 1 |
0 | 0 | If I call QApplication's init without arguments i get
TypeError: arguments did not match any overloaded call:
QApplication(list-of-str): not enough arguments
QApplication(list-of-str, bool): not enough arguments
QApplication(list-of-str, QApplication.Type): not enough arguments
QApplication(Display, int visual=0, int colormap=0): not enough arguments
QApplication(Display, list-of-str, int visual=0, int cmap=0): not enough arguments
very interesting! How can I write a class like that?? I mean, every trick for this kind of function overloading I saw did not involve explicit signatures. | true | 3,419,282 | 1.2 | 0 | 0 | 3 | TypeError is just another Exception. You can take *args **kwargs, check those, and raise a TypeError yourself, specify the text displayed - e.g. listing the expected call.
That being said, PyQt is a bunch of .pyd == native python extension, written in C or C++ (using Boost::Python). At least the latter supports "real" overloads afaik.
Either way, you shouldn't do this unless you have a really good reason. Python is duck-typed, embrace it. | 1 | 1,044 | 0 | 1 | 2010-08-05T21:24:00.000 | python,overloading | Python method overload based on argument count? | 0 | 2 | 2 | 3,419,420 | 1 |
0 | 0 | If I call QApplication's init without arguments i get
TypeError: arguments did not match any overloaded call:
QApplication(list-of-str): not enough arguments
QApplication(list-of-str, bool): not enough arguments
QApplication(list-of-str, QApplication.Type): not enough arguments
QApplication(Display, int visual=0, int colormap=0): not enough arguments
QApplication(Display, list-of-str, int visual=0, int cmap=0): not enough arguments
very interesting! How can I write a class like that?? I mean, every trick for this kind of function overloading I saw did not involve explicit signatures. | false | 3,419,282 | 0 | 0 | 0 | 0 | It's quite possible that its init is simply using __init__(self, *args, **kwargs) and then doing its own signature testing against the args list and kwargs dict. | 1 | 1,044 | 0 | 1 | 2010-08-05T21:24:00.000 | python,overloading | Python method overload based on argument count? | 0 | 2 | 2 | 3,419,307 | 1 |
0 | 0 | I have a Panel with a bunch of pictures placed on it in a GridSizer layout. How can I draw a highlighted color around the edge of an image or its border to show that it has been selected upon a mouse click event? | false | 3,431,154 | 0 | 0 | 0 | 0 | You could put each picture in a panel, and use SetBackgroundColour()to set the background color of the panel. | 0 | 233 | 0 | 1 | 2010-08-07T16:25:00.000 | python,wxpython | wxPython: Highlight item in GidSizer upon mouse click | 0 | 1 | 2 | 3,431,426 | 1 |
0 | 0 | I'm working on a form using wxPython where I want want listctrl's list of values to change based on the selection of another listctrl. To do this, I'm using methods linked to the controlling object's EVT_LIST_ITEM_SELECTED and EVT_LIST_ITEM_DESELECTED events to call Publisher.sendMessage. The control to be changed has a method that is a subscriber to that publisher. This works: when the first listctrl is clicked, the second is refreshed.
The problem is that the data must be refreshed from the database and a message is sent for every selection and deselection. This means that even if I simply click on one item, the database gets queried twice (once for the deselection, then again for the selection). If I shift-click to multi-select 5 items, then 5 calls get made. Is there any way to have the listctrl respond to the set, rather than the individual selections? | false | 3,441,991 | 0 | 0 | 0 | 0 | You can try EVT_LIST_ITEM_RIGHT_CLICK. That should work. Otherwise you'd want to use a flag and check said flag every time the selection event fires to see if it needs to query the database or not. There's also the UltimateListCtrl, a pure python widget, that you can probably hack to do this too. | 0 | 940 | 0 | 3 | 2010-08-09T16:12:00.000 | python,wxpython,listctrl | Respond to Listctrl change exactly once | 0 | 1 | 3 | 3,442,559 | 1 |
0 | 0 | I made a GUI with Tkinter, now how do I make it so when a key command will execute a command even if the Tkinter window is not in focus? Basically I want it so everything is bound to that key command.
Example:
Say I was browsing the internet and the focus was on my browser, I then type Ctrl + U. An event would then run on my program. | false | 3,445,867 | 0.379949 | 0 | 0 | 2 | Tkinter, on its own, cannot grab keystrokes that (from the OS's/WM's viewpoint) were directed to other, unrelated windows -- you'll need to instruct your window manager, desktop manager, or "operating system", to direct certain keystrokes differently than it usually does. So, what platform do you need to support for this functionality? Each platform has different ways to perform this kind of functionality, of course. | 0 | 515 | 0 | 1 | 2010-08-10T03:43:00.000 | python,binding,tkinter | Key commands in Tkinter | 0 | 1 | 1 | 3,445,919 | 1 |
0 | 0 | OK, I'm trying to explain what I want to achieve in another way. Here's an example:
Say if it's an anti virus program, and user can choose between two ways to run the program, choice one, automatically start to scan disks for virus when the program starts up, choice two, hit the start button to make the program scan disks for virus after the program starts up any time the user wants. So, as a wxpython beginner, I know how to bind wx.EVT_BUTTON to let scanning start after the user hit the start button, but I don't know how to make the scanning start once the program starts up. I wonder if there's a program_start event I can bind? Hope you guys can help me out. Thanks! | false | 3,450,525 | 0 | 0 | 0 | 0 | In your init or OnInit method, do some kind of check to see if the program should run the startup process on startup (i.e. check a config file or some such). If yes, call the "scan" method using wx.CallAfter or wx.CallLater or call it after you Show() the frame. | 0 | 372 | 0 | 0 | 2010-08-10T15:19:00.000 | python,event-handling,wxpython | Is there a wxpython event like program_start? | 0 | 2 | 3 | 3,451,727 | 1 |
0 | 0 | OK, I'm trying to explain what I want to achieve in another way. Here's an example:
Say if it's an anti virus program, and user can choose between two ways to run the program, choice one, automatically start to scan disks for virus when the program starts up, choice two, hit the start button to make the program scan disks for virus after the program starts up any time the user wants. So, as a wxpython beginner, I know how to bind wx.EVT_BUTTON to let scanning start after the user hit the start button, but I don't know how to make the scanning start once the program starts up. I wonder if there's a program_start event I can bind? Hope you guys can help me out. Thanks! | false | 3,450,525 | 0.066568 | 0 | 0 | 1 | Why don't you run it just in module code? This way it will be run only once, because code in module is run only once per program instance. | 0 | 372 | 0 | 0 | 2010-08-10T15:19:00.000 | python,event-handling,wxpython | Is there a wxpython event like program_start? | 0 | 2 | 3 | 3,450,557 | 1 |
0 | 0 | Is it possible to customize ProgressDialog in wxPython?
For instance, I would like to make the progressbar slimmer, and the window size wider.
SetSize() method doesn't appear to have any effect. | true | 3,452,986 | 1.2 | 0 | 0 | 1 | The wx.ProgressDialog isn't customizable its just a wrapper around the native ProgressDialog, the the easiest solution would be to roll your own by extending the wx.Dialog class and using a wx.Gauge | 0 | 352 | 0 | 0 | 2010-08-10T20:09:00.000 | python,wxpython,progress-bar | How to customize wx.ProgressDialog? | 0 | 1 | 1 | 3,453,038 | 1 |
0 | 0 | suppose a C++ class has several constructors which are overloaded according the number and type and sequences of their respective parameters, for example, constructor(int x, int y) and constructor(float x, float y, float z), I think these two are overloaded methods, which one to use depends on the parameters, right? So then in python, how could I create a constructor that can work like this? I notice that python has the def method(self, *args, **kwargs):, so can I use it like: def __init__(self, *args), then I check the length of *args, like if len(args) == 2:, then construct according to the 2-parameters constructor, if len(args) == 3, then use the 3-parameters constructor, etc. So, does that work? Or is there any better way to do it with python? Or should I think in other ways that could take the advantage of python feature itself? thanks~ | false | 3,476,387 | 0.148885 | 0 | 0 | 3 | Usually, you're fine with any combination of
slightly altered design
default arguments (def __init__(self, x = 0.0, y = 0.0, z = 0.0))
use of polymorphism (in a duck-typed language, you don't need an overload for SomeThing vs SomeSlightlyDifferentThing if neither inherits from the other one, as long as their interfaces are similar enough).
If that doesn't seem feasible, try harder ;) If it still doesn't seem feasible, look at David's link. | 1 | 251 | 0 | 1 | 2010-08-13T11:35:00.000 | c++,python,constructor,overloading | C++ methods overload in python | 0 | 1 | 4 | 3,476,486 | 1 |
0 | 0 | I want the text of the ListBox to be centered, is that possible? | true | 3,483,179 | 1.2 | 0 | 0 | 1 | No, the default ListBox won't work for that. Try the VListBox instead. | 0 | 434 | 0 | 0 | 2010-08-14T12:03:00.000 | python,listbox,wxpython,center,alignment | How to align the text in a wx.ListBox using wxPython? | 0 | 1 | 1 | 3,506,756 | 1 |
0 | 0 | Is it possible to use PyQt from IronPython?
From what I've read IronPython should work with CPython compatible libraries but out of the box it doesn't seem to work.
If it is possible, will code completion work? | false | 3,483,492 | 0.132549 | 0 | 0 | 2 | Hope someone else who spent more time messing around with this comes by and gives you qualified, ambiguous answer, but here is some questionable insight from my personal experience:
PyQt relates to cPython in a way that is very different than .Net relates to IronPython.
While IronPython is built on TOP of .Net, PyQt is a BINARY, semi-automatically generated set of bindings specific to a version of cPython against which it was compiled.
For a variety of reasons, i have problems running "standard" BINARY python modules against IronPython. Only the pure-Python modules that can be interpreted by IronPython as "Python" would ever work for me.
I am not saying "it can't be done," but I do expect you to have very bad experience with the set up if you manage to compile and install PyQt into IronPython. | 0 | 2,411 | 0 | 2 | 2010-08-14T13:25:00.000 | ironpython,pyqt | Using PyQt from IronPython | 0 | 1 | 3 | 3,490,601 | 1 |
0 | 0 | I'm working on a GUI program in which I already bind a start button with one event, and when I click the start button, the event runs as I like. My question is, if I want my program to start the event immediately after the GUI program starts, which means the start button is immediately being "clicked" once the program starts, how do I do it? | false | 3,483,675 | 0 | 0 | 0 | 0 | In the __init__( ) for your main frame put this:
wx.CallAfter( func_name ) | 0 | 205 | 0 | 0 | 2010-08-14T14:11:00.000 | python,event-handling,wxpython | How to make a event run immediately after a GUI program starts in wxpython? | 0 | 2 | 2 | 41,389,878 | 1 |
0 | 0 | I'm working on a GUI program in which I already bind a start button with one event, and when I click the start button, the event runs as I like. My question is, if I want my program to start the event immediately after the GUI program starts, which means the start button is immediately being "clicked" once the program starts, how do I do it? | true | 3,483,675 | 1.2 | 0 | 0 | 1 | In the main frame constructor set a one-shot timer with interval 0 that fires the event. | 0 | 205 | 0 | 0 | 2010-08-14T14:11:00.000 | python,event-handling,wxpython | How to make a event run immediately after a GUI program starts in wxpython? | 0 | 2 | 2 | 3,483,688 | 1 |
0 | 0 | How do I get a widget's "name"?
When I define a GUI using Glade, I can "name" the widgets of the window but how do I recover that property when I have a widget object instance?
I've tried get_property(), get_name() and $widget.name to no avail.
Update: I am using GtkBuilder file format (i.e. XML format).
Resolution: a fix I have used: use the set_property("name", name) method on the widget just after getting it from GtkBuilder. | false | 3,489,520 | 0 | 0 | 0 | 0 | Given the widget w, what does w.get_name() return? If None, that means the widget has no name property. Maybe you want gtk.glade.get_widget_name(w) instead? (I'm not sure if the name property of the widget and the name for it in the Glade XML from which it was created are the same thing...). | 0 | 4,906 | 0 | 10 | 2010-08-15T22:25:00.000 | python,gtk | Python GTK+ widget name | 0 | 1 | 3 | 3,489,566 | 1 |
0 | 0 | What is the format of the parameter activate_time in Python GTK+ when using Gtk.Menu.popup() method?
I have tried using int(time.time()) but I get a traceback saying an integer is required... | true | 3,494,587 | 1.2 | 0 | 0 | 1 | I found out I can use gtk.get_current_event_time() to get a reasonable timestamp matching what Gtk looks like it expects. | 0 | 132 | 0 | 0 | 2010-08-16T15:22:00.000 | python,gtk | Format of activate_time in Gtk.Menu | 0 | 1 | 2 | 3,495,112 | 1 |
0 | 0 | I render a huge SVG file with a lot of elements with Cairo, OpenGL and rsvg. I draw svg on cairo surface via rsvg and create an OpenGL texture to draw it. Everything is fine. And now I have to interact with elements from SVG. For example, I want to guess an element by coordinates. And I want to change the background of some path in SVG. In the case of changing background I think, I can change SVG DOM and somehow re-render a part of SVG. But in the case of hit testing elements I'm totally embarrassed.
So, is there some python library to interact with SVG? Is it possible to stay with cairo and rsvg and how can I implement it myself? Or is there a better way to render SVG in OpenGL and interact with it in python? All I want is load SVG, manipulate its DOM and render it | false | 3,501,215 | 0 | 0 | 0 | 0 | I had to do the same (changing element color for instance), and had to modify rsvg library because all those nice features exist but they are hidden. You have to make a new interface to link to the nice features. | 0 | 3,978 | 0 | 3 | 2010-08-17T09:51:00.000 | python,opengl,svg,cairo,rsvg | SVG interaction in python with cairo, opengl and rsvg | 0 | 1 | 3 | 37,703,846 | 1 |
0 | 0 | I'm writing an e-book reader in Python + wxPython, and I'd like to find out how many lines of text can be displayed in a given RichTextCtrl with the current formatting without scrolling.
I thought of using and dividing the control's height by RichTextCtrl.GetFont().GetPixelSize(), but it appears that the pixel size parameter of wx.Font is only specified on Windows and GTK. In addition, this won't cover any additional vertical spacing between lines/paragraphs.
I could of course get the font size in points, attempt to get the display's resolution in ppi, and do it that way, but 1) the line spacing problem still remains and 2) this is far too low a level of abstraction for something like this.
Is there a sane way of doing this?
EDIT: The objective is, to divide the ebook up into pages, so the scrolling unit is a whole page, as opposed to a line. | false | 3,504,383 | 0 | 0 | 0 | 0 | Did you try calling the GetNumberOfLines() method? According to Robin Dunn, that should work, although it doesn't take wrapped lines into account. | 0 | 445 | 0 | 2 | 2010-08-17T15:52:00.000 | python,wxpython,resolution-independence | Finding out how many lines can be displayed in wx.richtext.RichTextCtrl without scrolling | 0 | 1 | 2 | 3,526,358 | 1 |
0 | 0 | I would like to know how i can select a pixel with a mouse click in an image (QImge) and get pixel position and value.
Thanks | false | 3,504,522 | 0.132549 | 0 | 0 | 2 | First you have to draw the image. You can do this my making a QLabel widget and call setPixmap. You need to convert your QImage to QPixmap before doing this (you can use QPixmap.fromImage(img)).
You can get mouse clicks by subclassing the QImage and intercepting mousePressEvent. Look up the pixel value with QImage.pixel(). | 0 | 19,296 | 0 | 9 | 2010-08-17T16:05:00.000 | python,image,pyqt,selection,pixel | Pyqt get pixel position and value when mouse click on the image | 0 | 1 | 3 | 3,543,483 | 1 |
0 | 0 | Here is what I would like to do, and I want to know how some people with experience in this field do this:
With three POST requests I get from the http server:
widgets and layout
and then app logic (minimal)
data
Or maybe it's better to combine the first two or all three. I'm thinking of using pyqt. I think I can load .ui files. I can parse json data. I just think it would be rather dangerous to pass code over a network to be executed on the client. If someone can hijack the connection, or can change the apps setting to access a bogus server, that is nasty.
I want to do it this way because it keeps all the clients up-to-date. It's sort of like a webapp but simpler because of Qt. Essentially the "thin" app is just a minimal compiled python file that loads data from a server.
How can I do this without introducing security issues on the client? Is https good enough? Is there a way to get pyqt to run in a sandbox of sorts?
PS. I'm not stuck on Qt or python. I do like the concept though. I don't really want to use Java - server or client side. | true | 3,517,841 | 1.2 | 0 | 0 | 1 | Your desire to send "app logic" from the server to the client without sending "code" is inherently self-contradictory, though you may not realize that yet -- even if the "logic" you're sending is in some simplified ad-hoc "language" (which you don't even think of as a language;-), to all intents and purposes your Python code will be interpreting that language and thereby execute that code. You may "sandbox" things to some extent, but in the end, that's what you're doing.
To avoid hijackings and other tricks, instead, use HTTPS and validate the server's cert in your client: that will protect you from all the problems you're worrying about (if somebody can edit the app enough to defeat the HTTPS cert validation, they can edit it enough to make it run whatever code they want, without any need to send that code from a server;-).
Once you're using https, having the server send Python modules (in source form if you need to support multiple Python versions on the clients, else bytecode is fine) and the client thereby save them to disk and import / reload them, will be just fine. You'll basically be doing a variant of the classic "plugins architecture" where the "plugins" are in fact being sent from the server (instead of being found on disk in a given location). | 0 | 1,647 | 0 | 0 | 2010-08-19T00:33:00.000 | python,qt,networking,pyqt,thin | how to implement thin client app with pyqt | 1 | 1 | 2 | 3,517,886 | 1 |
0 | 0 | I made a frame that asks the user to put in a bunch of information in several text control fields. How can I make it so that when you hit the 'tab' key your cursor moves to the next text control? | false | 3,525,005 | 0.379949 | 0 | 0 | 2 | If you put a wx.Panel as the only child of the ScrolledWindow and put the other widgets on the panel, then it should work automatically. You could also use ScrolledPanel instead. | 0 | 595 | 0 | 3 | 2010-08-19T18:29:00.000 | python,wxpython | wxPython: switching text control focus on tab press | 0 | 1 | 1 | 3,525,652 | 1 |
0 | 0 | I'm displaying some data as a TreeView. How can I detect a click on a particular tree-view cell, so that I know which column of which row was clicked on?
This is what I want to do, so maybe there's a better way: Part of the data is a series of True/False values indicating a particular set of options. For example, the options might be picking any of the options "Small, Medium, Large, X-Large" to be display. If the user selects "Small" and "Large", then the cell should display "Small, Large". I don't want to give each a separate column since there are actually like 20 options, and only 2 or 3 will be selected at any point.
When the user clicks on the cell, I want to display a pop-up with a bunch of checkboxes. The user can then select what s/he wants and submit the changes, at which point the cell's value should be updated.
The easiest way I thought of doing this would be to just detect a click (or a double-click) on the cell. Then I could pop up the window, and have the submit button of the window do what I want. | true | 3,534,127 | 1.2 | 0 | 0 | 6 | The row-activated signal is sent when a GTK TreeView row is double-clicked. | 0 | 4,742 | 0 | 5 | 2010-08-20T19:17:00.000 | python,user-interface,gtk,pygtk | gtk: detect click on a cell in a TreeView | 0 | 1 | 2 | 3,534,190 | 1 |
0 | 0 | What Python-related code (PyGTK, Glade, Tkinter, PyQT, wxPython, Cairo, ...) could you easily use to create a GUI to do some or all of the following?
Part of the GUI has an immovable square grid.
The user can press a button to create a resizable rectangle.
The user can drag the rectangle anywhere on the grid, and it will snap to the grid. | false | 3,538,769 | 0 | 0 | 0 | 0 | Those actions are not that difficult. All you really need for that is hit detection, which is not hard (is the cursor over the correct area? Okay, perform the operation then). The harder part is finding an appropriate canvas widget for the toolkit in use. | 0 | 5,729 | 0 | 7 | 2010-08-21T20:09:00.000 | python,user-interface,pygtk,tkinter,glade | How do you draw a grid and rectangles in Python? | 0 | 1 | 3 | 3,538,804 | 1 |
0 | 0 | I'm currently in the process of making my Nintendo Wiimote (Kinda sad actually) to work with my computer as a mouse. I've managed to make the nunchuk's stick control actually move the mouse up and down, left and right on the screen! This was so exciting. Now I'm stuck.
I want to left/right click on things via python when I press A, When I went to do a search, All it came up with was tkinter?
So my question is, What do I call to make python left/right click on the desktop, and if it's possible, maybe provide a snippet?
Thank you for your help!
NOTE: I guess I forgot to mention that this is for Linux. | false | 3,545,230 | 0.049958 | 0 | 0 | 2 | Open your terminal and goto cd /usr/share/pyshared/twisted/protocols/mice
may this __init__.py mouseman.py python script will work for you,check them out. | 0 | 65,052 | 0 | 40 | 2010-08-23T06:42:00.000 | python,linux,mouse,mouse-cursor,wiimote | Simulate Mouse Clicks on Python | 0 | 1 | 8 | 9,583,583 | 1 |
0 | 0 | I want to add images to wx.Dialog (and then sizer) some like wx.ImageList and display it dynamically.
But I don't want to change already displayed image, I want to add next.
How can I resolve this problem? | false | 3,555,065 | 0.379949 | 0 | 0 | 2 | I don't think a dialog is a good choice for a growing list of images, but if you have a good argument for that...
Anyway, you should be able to display your images using the wx.StaticBitmap widget. To add another one, use your sizer's Add method, then call the dialog's Layout() method and maybe its Refresh() method. If you plan on displaying many images, then you'll probably want to look at the ScrolledPanel or the ScrolledWindow widgets. | 0 | 883 | 0 | 1 | 2010-08-24T09:21:00.000 | python,image,wxpython | How to add images/bitmaps to wx.Dialog | 0 | 1 | 1 | 3,557,437 | 1 |
0 | 0 | Assume i want to create 500 wxWidget like (some panels , color buttons and text ctrl etc), I have to create all this at single time but this will freeze my main thread, so i put this creation part in child thread and show some gif anim in main thread. But i was not able to get all these wxWidget object those created on my frame in child thread.
Can i get that wxWidgets (created in child thread) back in main thread.
simply just consider a case where i have to create children of a frame in child thread and main thread show animation. once child thread finish the all child created in child thread should available in main thread.
Any help is really appreciable.
I am using python 2.5, wxpython 2.8 on windowsxp. | false | 3,574,714 | 0 | 0 | 0 | 0 | You can send them back over a queue, or this all takes place in one instance of a class, assign the widgets to some known place in the instance for the main thread to pick them up. Signal via semaphore. | 0 | 649 | 0 | 1 | 2010-08-26T11:42:00.000 | python,wxpython | Get object created in child thread back in main thread | 0 | 1 | 2 | 3,574,976 | 1 |
0 | 0 | So, for example I draw some objects on wx.PaintDC, such as lines and rectangles.
Now I want next: on mouse click I wont know which object was clicked.
Of course, I can see what object is the closest, but what about more exact answer?
Maybe even not standart wx.DC, but such things as FloatCanvas or something like this.
So, what's the best solution? | false | 3,576,071 | 0 | 0 | 0 | 0 | Does calling event.GetEventObject() in your event handler give you the object you need? | 0 | 100 | 0 | 0 | 2010-08-26T14:24:00.000 | python,user-interface,wxpython | What is the best solution to bind objects in wx.DC? | 0 | 1 | 2 | 3,579,195 | 1 |
0 | 0 | I would like to implement a button "New" that would work the same as File>New in most applications - that is: resets all the labels, treeviews, etc. to the original state.
Thank you, Tomas | true | 3,577,335 | 1.2 | 0 | 0 | 1 | The widgets don't remember their original state; you have to set them all back one by one. Give labels their original text, clear the tree views by setting their model to None.
Perhaps it is better to destroy your window and rebuild it from your Glade file if you have one? | 0 | 263 | 0 | 0 | 2010-08-26T16:39:00.000 | python,gtk,pygtk | How do I restore default settings of an application in Gtk (set all the widgets to the state as if the application was restarted)? | 0 | 1 | 1 | 3,580,114 | 1 |
0 | 0 | I have made an application using Glade and Python and I would like to make several localizations.
I know how to localize strings that are in the Python code, I just encapsule all the strings that are supposed to be localized with _() and than specify the translation of the string in a .po file.
But how do I tell a string that is built with Glade that it should be localizable (for example labels, menu items, button labels, ...)?
I am using gettext for the localization.
Thank you, Tomas | true | 3,586,071 | 1.2 | 0 | 0 | 4 | You should be able to create a *.pot file from a *.glade file using intltool-extract --type=gettext/glade foo.glade, and intltool supposedly knows what is translatable.
Also, I suggest you look into GtkBuilder if you didn't do that already (you can save GtkBuilder interface files from recent Glade 3 versions, and you won't need the extra libglade anymore). | 0 | 1,203 | 0 | 7 | 2010-08-27T16:05:00.000 | python,user-interface,pygtk,gettext,glade | Localization of GUI built with Glade and Python (Gtk) | 0 | 1 | 1 | 3,588,790 | 1 |
0 | 0 | I want to make a PyQt4 program that supports plugins. Basically I want the user to be able to write QWidget subclasses in PyQt4 and add/remove them from the main application window via a GUI. How would I do that, especially the plugin mechanism? | false | 3,588,915 | 0 | 0 | 0 | 0 | Have a directory for the plugins, define an interface for those plugins, and walk the directory importing them.
I've never done this in Python, but in C the way I did it was to define a number of functions that the plugin needed to implement. The basic key elements that are necessary is the name of the things in the plugin (so that you can display them in your UI so that the user can instantiate them) and a factory to actually create the things. I suppose in Python it'd be pretty trivial to just do those as one dict that you can return from the module.
E.g. declare that all plugins must author a function called GetPluginInfo() which returns a dictionary of name:class mappings.
Actually now that I think about it you could probably just import the file and look for classes that are subclasses of whatever you care about and not require any explicit API be implemented. I haven't done a lot of that but basically you'd walk the module's dir() and test to see if each thing is a subclass of QWidget (for example). | 0 | 834 | 0 | 2 | 2010-08-28T00:28:00.000 | python,qt,plugins,pyqt4,pluggable | Pluggable Python program | 0 | 1 | 2 | 3,588,947 | 1 |
0 | 0 | Is there a command similar to "wm_overrideredirect" for Ubuntu? I want My program to be displayed without the standard window. | true | 3,589,185 | 1.2 | 0 | 0 | 3 | Ubuntu's desktop manager is Gnome, which should support wm_overrideredirect as well as any other. What's going wrong for you when you try that? Can you show (by editing your Q) some as-tiny-as-possible Python/Tkinter script that does not behave the way you want, and tell us how it does behave and how you'd like to behave? | 0 | 182 | 0 | 0 | 2010-08-28T02:26:00.000 | python,ubuntu,window,tkinter | Tkinter removing standard window in Ubuntu | 0 | 1 | 2 | 3,589,200 | 1 |
0 | 0 | I have an existing python script and I want to wrap it in a GUI. Since I already have tkinter installed I would like to use it if possible. At the moment my script has many places where it asks for user input using raw_input(). I would like to replace these with either a modal pop-up asking for user input or (preferably) an Entry object which responds to the enter key. | true | 3,589,817 | 1.2 | 0 | 0 | 2 | UI toolkits usually have an event-driven model where the main loop is in the toolkit itself. This is probably different from your current synchronous, interactive model (where the program just pauses while waiting for input)
The best would be to try to refactor your program and factor-out the view part (look up the model-view-control design pattern). After that, it should be easy to replace your console oriented view with an tkInter based one.
(that's as specific as I can get without a concrete question) | 0 | 1,228 | 0 | 0 | 2010-08-28T07:08:00.000 | python,user-input,tkinter | Creating a gui around a python script using Tkinter | 0 | 1 | 1 | 3,589,984 | 1 |
0 | 0 | I am new to the world of GUI programming and I am writing a little GUI app using IronPython and WinForms. It reads values from an external device and displays them in a ListView component (name, value). I want to periodically perform the reading and updating of the ListView component at a certain fixed rate.
I had the following ideas to accomplish this:
A timer, which periodically triggers the read/screen update directly in the OnTick handler
A timer, whose OnTick handler triggers a BackgroundWorker to perform the read/update
Since the first solution will block the GUI until the read/update loop is done, which, depending on the number of values being read from the device, could take some time, I think the BackgroundWorker might be a better solution. I might want to add some functionality to manipulate the ListView items later (add, remove values etc.) and a blocked GUI does not seem like a good idea.
Is there a certain design pattern or a better way to accomplish reading/updating screen data?
NOTE: Any code examples can be IronPython or C#. The conversion from C# to IronPython is pretty straight forward. Thanks! | true | 3,595,236 | 1.2 | 0 | 0 | 3 | Personally, I'd have one thread that's responsible for reading values out of the device and storing the data in a data structure, and then a System.Windows.Forms.Timer (there's 3 Timers in .NET, this is the only one that ticks in the thread that's safe to update your controls) to read values out of that data structure and update the UI. You may need to synchronise that data structure, you may not.
That way the device can take as long as it likes to return data, or it can push as many millions of rows per second at you, and the UI thread will still poll at your predetermined tick rate (probably every 100 msec?). Since your timer ticks are just reading data out of memory, the UI won't block for IO. | 0 | 1,455 | 0 | 2 | 2010-08-29T15:03:00.000 | c#,winforms,ironpython | Pattern for periodically updating screen data | 0 | 1 | 3 | 3,595,266 | 1 |
0 | 0 | I was wondering if there is a good library for python for decoding QR code. Basically what I would like is to give library image with QR code on it and the library would output contents saved in image. | true | 3,602,645 | 1.2 | 0 | 0 | 2 | I've looked before with no success. Two problems are that native c code can't be compiled and you can't get access to the file system.
pyqrcode didn't work out and neither did zxing. | 0 | 3,926 | 0 | 4 | 2010-08-30T17:15:00.000 | python,google-app-engine,qr-code | Google app engine QR code decoder | 0 | 1 | 4 | 3,602,758 | 1 |
0 | 0 | I'm trying to write a simple GTD-style todo list app with python and gtk to learn python. I want a container that can select an individual list from a lot of choices. It would be something like the list of notebooks area in tomboy. Not a combobox.
As you can probably tell I'm a beginner and the terminology is probably off.
Can you please tell me what it is I'm looking for and an overview of how to implement it? | false | 3,604,357 | 0 | 0 | 0 | 0 | You mean a widget to filter a large collection into multiple subsets / views?
I would guess you have to implement this yourself - a list of options on the left and filtered results on the right, I don't know of any existing (gtk) widgets. | 1 | 256 | 0 | 1 | 2010-08-30T21:28:00.000 | python,user-interface,gtk | Python PyGTK. What's this component? | 0 | 1 | 3 | 3,604,511 | 1 |
0 | 0 | I don't get what Clyther is or how to use it.
My stuff:
ATI OpenCl SDK (just dl'd)
clyther beta (just dl'd)
windows 7 pro 64 bit
active python 3.1.2
Xfxs Ati radeon 5850 video card
I downloaded the ATI OpenCl SDK and the clyther beta from sourceforge. Then I tooke the sample 'reduce' function from the sourceforge documents and pasted the code into notepad and named it clythersample.py. When I double-click the file or open it in the interactiveshell, it gives an error message on the first line.
Is naming the file .py wrong? I guess clyther is its own lqnguage and not really python? Can I write python code and in the middle of the program, write a chunk of clyther code? Will python IDEs (esp. Wing understand and debug it?) Will it work with python 3 or do I need 2.6? Is 64 bit os ok?
(I'm not a programme or technically competent, so things like its a python API for OpenCl or it had C bindings for python don't mean a whole lot). | false | 3,612,410 | 0.197375 | 0 | 0 | 2 | Clyther is a Python package for High-Performance Computing (HPC) using, for example, video cards with multiple Graphics Packaging Units (GPUs) or (less frequently) multi-core processors. Clyther is for parallel processing of algorithms or data sets that would normally take a lot of time to process serially. Meaning, if you have a problem that can be split into many smaller problems, then Clyther is a useful package to use. Additionally, your problem must be something that can use numpy arrays.
Clyther is a nice package to use if you have the problem it is intended to solve. It makes it fairly easy to write Python code to run on multiple processes.
If that's not the problem you need to solve, then Clyther probably won't help you. | 0 | 507 | 0 | 2 | 2010-08-31T19:18:00.000 | python,python-3.x,gpu | Clyther-how to get started? | 0 | 2 | 2 | 10,986,086 | 1 |
0 | 0 | I don't get what Clyther is or how to use it.
My stuff:
ATI OpenCl SDK (just dl'd)
clyther beta (just dl'd)
windows 7 pro 64 bit
active python 3.1.2
Xfxs Ati radeon 5850 video card
I downloaded the ATI OpenCl SDK and the clyther beta from sourceforge. Then I tooke the sample 'reduce' function from the sourceforge documents and pasted the code into notepad and named it clythersample.py. When I double-click the file or open it in the interactiveshell, it gives an error message on the first line.
Is naming the file .py wrong? I guess clyther is its own lqnguage and not really python? Can I write python code and in the middle of the program, write a chunk of clyther code? Will python IDEs (esp. Wing understand and debug it?) Will it work with python 3 or do I need 2.6? Is 64 bit os ok?
(I'm not a programme or technically competent, so things like its a python API for OpenCl or it had C bindings for python don't mean a whole lot). | false | 3,612,410 | 0.099668 | 0 | 0 | 1 | When you name the file .py (the file extension associated with python.exe) and double-click it, how is windows supposed to know it's supposed to run the file with CLyther?
Is naming the file .py wrong? I guess clyther is its own lqnguage and not really python?
Documentation compares it with Cython - so I suppose it's an extension to the language, i.e. they take Python and bolt more features on it.
Can I write python code and in the middle of the program, write a chunk of clyther code?
From the goals of the project, it should (like Cython) ultimately be able to accept all or most Python code. So, yes - but of course you'd have to run the whole program with CLyther.
Will python IDEs (esp. Wing understand and debug it?)
Not natively, I suppose.
Side note: The project is in a very early stage of developement (very first beta-release), so don't expect things to run smoothly right now. | 0 | 507 | 0 | 2 | 2010-08-31T19:18:00.000 | python,python-3.x,gpu | Clyther-how to get started? | 0 | 2 | 2 | 3,612,526 | 1 |
0 | 0 | I have a python script bundled into a application (I'm on a mac) and have the application set to be able to open .zip files. But when I say "open foo.zip with bar.py" how do I access the file that I have passed to it?
Additional info:
Using tkinter.
What's a good way to debug this, as there is no terminal to pass info to? | false | 3,614,609 | 0 | 0 | 0 | 0 | If I'm not greatly mistaken, it should pass the name of the file as the first argument to the script - sys.argv[1]. | 1 | 310 | 0 | 0 | 2010-09-01T02:17:00.000 | python,macos,tkinter | Python: open a file *with* script? | 0 | 1 | 2 | 3,614,650 | 1 |
0 | 0 | I have a widget that measures elapsed time, then after a certain duration it does a command. However, if the widget is left I want I want it to abort this function call and not do the command.
How do I go about this? | false | 3,621,111 | 0 | 0 | 0 | 0 | Why not use threads and stop that? I don't think it's possible to intercept a function call in a single threaded program (if not with some kind of signal or interrupt).
Also, with your specific issue, you might want to introduce a flag and check that in the command. | 0 | 88 | 0 | 1 | 2010-09-01T18:38:00.000 | python,tkinter,abort | Is there a way to write a command so that it aborts a running function call? | 0 | 2 | 3 | 3,621,138 | 1 |
0 | 0 | I have a widget that measures elapsed time, then after a certain duration it does a command. However, if the widget is left I want I want it to abort this function call and not do the command.
How do I go about this? | false | 3,621,111 | 0 | 0 | 0 | 0 | No idea about python threads, but in general the way you interrupt a thread is by having some sort of a threadsafe state object that you can set from the widget, and the logic in thread code to check for the change in state object value and break out of the thread loop. | 0 | 88 | 0 | 1 | 2010-09-01T18:38:00.000 | python,tkinter,abort | Is there a way to write a command so that it aborts a running function call? | 0 | 2 | 3 | 3,621,195 | 1 |
0 | 0 | Is it possible to bind all widgets to one command, with a single line? It would be nice if I could type in one line as opposed to doing each widget individually. | false | 3,630,664 | -0.099668 | 0 | 0 | -2 | If you have a list that contains all your widgets, you could iterate over them and assign the events. | 0 | 9,705 | 0 | 7 | 2010-09-02T19:49:00.000 | python,binding,widget,tkinter,global | Tkinter Global Binding | 0 | 2 | 4 | 3,630,691 | 1 |
0 | 0 | Is it possible to bind all widgets to one command, with a single line? It would be nice if I could type in one line as opposed to doing each widget individually. | false | 3,630,664 | -0.148885 | 0 | 0 | -3 | You could also just define a function that calls on all your widgets, and call that function. Or better yet create a class that call on your widgets in init and import the class... | 0 | 9,705 | 0 | 7 | 2010-09-02T19:49:00.000 | python,binding,widget,tkinter,global | Tkinter Global Binding | 0 | 2 | 4 | 3,630,962 | 1 |
0 | 0 | I have a python program that has no windows frame and doesn't show up in the taskbar because of self.overrideredirect(1). This program has an options menu (a top level widget) that allows for the alpha to be adjusted with self.attributes("-alpha", 0.85). However when I close out of the options menu my program shows up in the task bar. Obviously I don't want it to do this. I tried invoking the self.overrideredirect(1) command after the options menu was closed, but to no avail. Does anyone have a solution/ know of a line that will remove my program from the task bar? | true | 3,644,113 | 1.2 | 0 | 0 | 0 | If you change the override redirect flag you need to withdraw and then deiconify the window to give the window manager a chance to make the change. You might try that.
Also, when you say "close out" the option menu top-level, what exactly do you mean? Are you sure destroying this second top-level window? | 0 | 2,723 | 0 | 0 | 2010-09-04T21:43:00.000 | python,windows,transparency,tkinter,alpha | Help with Tkinter Alpha | 0 | 1 | 2 | 3,644,372 | 1 |
0 | 0 | I'm trying to retrieve the row data from a treemodel when the row_activated callback is fired.
When row_activated is called, the 'path' variable it passes is a tuple. How do I easily use this tuple to retrieve an iter and ultimately the data itself? The treemodel class has a function to convert a string into an iter, but it seems like there should be an easier way than converting the tuple to a string, then the string to an iter. | true | 3,644,777 | 1.2 | 0 | 0 | 2 | Answering my own question, it makes sense after 45 minutes of googling I solve my own problem 30 seconds after posting on StackOverflow.
I needed to use the get_iter function, not the get_iter_from_string function. | 0 | 262 | 0 | 1 | 2010-09-05T02:32:00.000 | python,pygtk | PyGTK treeview and row_activated callback | 0 | 1 | 1 | 3,644,788 | 1 |
0 | 0 | I am starting to use python,more. Is there a good way to keep python disk access to a minimum.
Seems to me that everytime a *.py file runs, it hits a hard disk. Is there way to avoid hitting the harddisk, and keep *.py file in memory and access it there.
Would creating a small gui using Wxframe, keep code in memory, and reuse work or is it more pain vs benefit. | true | 3,647,368 | 1.2 | 0 | 0 | 2 | If you run a .py file from the harddisk, the harddisk will be accessed.
In your GUI, just import your code and it will be loaded once and you can access it later. | 0 | 181 | 0 | 0 | 2010-09-05T19:08:00.000 | python,wxpython | Python Software design | 0 | 3 | 3 | 3,647,374 | 1 |
0 | 0 | I am starting to use python,more. Is there a good way to keep python disk access to a minimum.
Seems to me that everytime a *.py file runs, it hits a hard disk. Is there way to avoid hitting the harddisk, and keep *.py file in memory and access it there.
Would creating a small gui using Wxframe, keep code in memory, and reuse work or is it more pain vs benefit. | false | 3,647,368 | 0.132549 | 0 | 0 | 2 | Modern operating systems cache file access pretty efficiently, as long as there is enough spare RAM available. You most likely won't notice any difference, fi you're not loading thousand of python files at once.
And as always, before trying to optimize one aspect, make sure that this is really the bottleneck. Chances are, your percieved slowness is not due to loading of the .py files. | 0 | 181 | 0 | 0 | 2010-09-05T19:08:00.000 | python,wxpython | Python Software design | 0 | 3 | 3 | 3,647,570 | 1 |
0 | 0 | I am starting to use python,more. Is there a good way to keep python disk access to a minimum.
Seems to me that everytime a *.py file runs, it hits a hard disk. Is there way to avoid hitting the harddisk, and keep *.py file in memory and access it there.
Would creating a small gui using Wxframe, keep code in memory, and reuse work or is it more pain vs benefit. | false | 3,647,368 | 0 | 0 | 0 | 0 | I think if you took the time to measure how much time it takes to load your python code from disk you would end up with a very, very tiny number unless you are doing something very wrong. And if you are doing something really wrong, solving that problem will be a better use of your time.
Using wxpython to create a guy to work around what you perceive to be a problem wouldn't likely make any difference. | 0 | 181 | 0 | 0 | 2010-09-05T19:08:00.000 | python,wxpython | Python Software design | 0 | 3 | 3 | 3,647,549 | 1 |
1 | 0 | I'm having a right old nightmare with JPype. I have got my dev env on Windows and so tried installing it there with no luck. I then tried on Ubunto also with no luck. I'm getting a bit desperate now. I am using Mingw32 since I tried installing VS2008 but it told me I had to install XP SP2 but I am on Vista. I tried VS2010 but no luck, I got the 'error: Unable to find vcvarsall.bat' error. Anyway, I am now on Mingw32
Ultimately I am trying to use Neo4j and Python hence my need to use JPype. I have found so many references to the problem on the net for MySQL etc but they don't help me with JPype.
If I could fix unix or windows I could get going so help on either will be really appreciated.
Here's the versions..
Windows: Vista 64
Python: 2.6
Compiler Mingw32: latest version
Jpype: 0.5.4.1
Java info:
java version "1.6.0_13"
Java(TM) SE Runtime Environment (build 1.6.0_13-b03)
Java HotSpot(TM) 64-Bit Server VM (build 11.3-b02, mixed mode)
I run:
python setup.py install --compiler=wingw32
and get the following output.
Choosing the Windows profile
running install
running build
running build_py
running build_ext
building '_jpype' extension
C:\MinGW\bin\gcc.exe -mno-cygwin -mdll -O -Wall -DWIN32=1 "-IC:\Program Files (x86)\Java\jdk1.6.0_21/include" "-IC:\Program Files (x86)\Java\jdk1.6.0_21/include/win32" -Isrc/native/common/include -Isrc/native/python/include -Ic:\Python26\include -Ic:\Python26\PC -c src/native/common/jp_array.cpp -o build\temp.win32-2.6\Release\src\native\common\jp_array.o /EHsc
src/native/common/jp_array.cpp: In member function 'void JPArray::setRange(int, int, std::vector&)':
src/native/common/jp_array.cpp:56:13: warning: comparison between signed and unsigned integer expressions
src/native/common/jp_array.cpp:68:4: warning: deprecated conversion from string constant to 'char*'
src/native/common/jp_array.cpp: In member function 'void JPArray::setItem(int, HostRef*)':
src/native/common/jp_array.cpp:80:3: warning: deprecated conversion from string constant to 'char*'
gcc: /EHsc: No such file or directory
error: command 'gcc' failed with exit status 1
So on unix Ubunto the problem is as follows:
Java version: 1.6.0_18
JPype: 0.5.4.1
Python: 2.6
Java is in the path and I did apt-get install build-essentials just now so have latest GCC etc.
I won't paste all the output as it's massive. So many errors it's like I have missed the install of Java or similar but I haven't. typing java takes me into version above. This is the beginning:
running install
running build
running build_py
running build_ext
building '_jpype' extension
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/lib/jvm/java-1.5.0-sun-1.5.0.08/include -I/usr/lib/jvm/java-1.5.0-sun-1.5.0.08/include/linux -Isrc/native/common/include -Isrc/native/python/include -I/usr/include/python2.6 -c src/native/common/jp_javaenv_autogen.cpp -o build/temp.linux-i686-2.6/src/native/common/jp_javaenv_autogen.o
cc1plus: warning: command line option "-Wstrict-prototypes" is valid for Ada/C/ObjC but not for C++
In file included from src/native/common/jp_javaenv_autogen.cpp:21:
src/native/common/include/jpype.h:45:17: error: jni.h: No such file or directory
In file included from src/native/common/jp_javaenv_autogen.cpp:21:
src/native/common/include/jpype.h:77: error: ISO C++ forbids declaration of ‘jchar’ with no type
src/native/common/include/jpype.h:77: error: expected ‘,’ or ‘...’ before ‘’ token
src/native/common/include/jpype.h:82: error: ISO C++ forbids declaration of ‘jchar’ with no type
src/native/common/include/jpype.h:82: error: expected ‘;’ before ‘’ token
src/native/common/include/jpype.h:86: error: ISO C++ forbids declaration of ‘jchar’ with no type
src/native/common/include/jpype.h:86: error: expected ‘;’ before ‘&’ token
src/native/common/include/jpype.h:88: error: expected ‘;’ before ‘private’
src/native/common/include/jpype.h:89: error: ISO C++ forbids declaration of ‘jchar’ with no type
src/native/common/include/jpype.h:89: error: expected ‘;’ before ‘*’ token
In file included from src/native/common/include/jpype.h:96,
from src/native/common/jp_javaenv_autogen.cpp:21:
And this is the end:
src/native/common/include/jp_monitor.h:27: error: ‘jobject’ does not name a type
src/native/common/jp_javaenv_autogen.cpp:30: error: ‘jbyte’ does not name a type
src/native/common/jp_javaenv_autogen.cpp:38: error: ‘jbyte’ does not name a type
src/native/common/jp_javaenv_autogen.cpp:45: error: variable or field ‘SetStaticByteField’ declared void
src/native/common/jp_javaenv_autogen.cpp:45: error: ‘jclass’ was not declared in this scope
src/native/common/jp_javaenv_autogen.cpp:45: error: ‘jfieldID’ was not declared in this scope
src/native/common/jp_javaenv_autogen.cpp:45: error: ‘jbyte’ was not declared in this scope
error: command 'gcc' failed with exit status 1 | false | 3,649,577 | 0.066568 | 0 | 1 | 1 | Edit the Setup.py and remove the /EHsc option. | 0 | 3,736 | 0 | 3 | 2010-09-06T06:54:00.000 | java,python | JPype compile problems | 0 | 1 | 3 | 6,258,169 | 1 |
0 | 0 | I'm working on a wxPython app which has multiple frames and a serial connection. I need to be able to exit the app cleanly, closing the serial connection as the app terminates.
What is the best way to do this? Should this be handled by a subclass of wxApp?
Thanks,
Josh | false | 3,673,418 | 0 | 0 | 0 | 0 | I usually use my close button's event handler to close connections and what-not before closing the frame. If you want to catch the upper right "x" button, then you'll need to bind to EVT_CLOSE. Unfortunately, when you do that, you need to call your frame's Destroy() method rather than its Close() method or you'll end up in an infinite loop. | 0 | 1,263 | 0 | 2 | 2010-09-09T02:43:00.000 | python,wxpython | Terminating a wxPython app cleanly | 0 | 1 | 2 | 3,677,070 | 1 |
0 | 0 | There are a lot of games that can generally be viewed as a bunch of objects spread out through space, and a very common operation is to pick all objects in a sub-area. The typical example would be a game with tons of units across a large map, and an explosion that affects units in a certain radius. This requires picking every unit in the radius in order to apply the effects of the explosion.
Now, there are several ways to store objects that allows efficiently picking a sub-area. The easiest method is probably to divide the map into a grid; picking units in an area would involve selecting only the parts of the grid that is affected, and do a fine-grained coordinate check grid tiles that aren't 100% inside the area.
What I don't like about this approach is answering "How large should the grid tiles be?" Too large, and efficiency may become a real problem. Too small, and the grid takes up tons of memory if the game world is large enough (and can become ridiculous if the game is 3d). There may not even be a suitable golden mean.
The obvious solution to the above is to make a large grid with some kind of intelligent subdivision, like a pseudo tree-structure. And it is at this point I know for sure I am far into premature optimization. (Then there are proper dynamic quad/octrees, but that's even more complex to code and I'm not even confident it will perform any better.)
So my question is: Is there a standard solution to the above problem? Something, in the lines of an STL container, that can just store any object with a coordinate, and retreive a list of objects within a certain area? It doesn't have to be different than what I described above, as long as it's something that has been thought out and deemed "good enough" for a start.
Bonus points if there is an implementation of the algorithm in Python, but C would also do. | false | 3,691,278 | 0.066568 | 0 | 0 | 1 | The first step to writing a practical program is accepting that choices for some constants come from real-world considerations and not transcendent mathematical truths. This especially applies to game design/world simulation type coding, where you'd never get anywhere if you persisted in trying to optimally model the real world. :-)
If your objects will all be of fairly uniform size, I would just choose a grid size proportional to the average object size, and go with that. It's the simplest - and keep in mind simplicity will buy you some speed even if you end up searching over a few more objects than absolutely necessary!
Things get a big harder if your objects vary greatly in size - for example if you're trying to use the same engine to deal with bullets, mice, humans, giant monsters, vehicles, asteroids, planets, etc. If that's the case, a common accepted (but ugly) approach is to have different 'modes' of play depending on the type of situation you're in. Short of that, one idea might be to use a large grid with a binary-tree subdivision of grid cells after they accumulate too many small objects.
One aside: if you're using floating point coordinates, you need to be careful with precision and rounding issues for your grid size, since points close to the origin have a lot more precision than those far away, which could lead to errors where grid cells miss some objects. | 0 | 293 | 0 | 2 | 2010-09-11T14:08:00.000 | python,c,containers | A container for accessing contents by 2d/3d coordinates | 0 | 2 | 3 | 3,691,446 | 1 |
0 | 0 | There are a lot of games that can generally be viewed as a bunch of objects spread out through space, and a very common operation is to pick all objects in a sub-area. The typical example would be a game with tons of units across a large map, and an explosion that affects units in a certain radius. This requires picking every unit in the radius in order to apply the effects of the explosion.
Now, there are several ways to store objects that allows efficiently picking a sub-area. The easiest method is probably to divide the map into a grid; picking units in an area would involve selecting only the parts of the grid that is affected, and do a fine-grained coordinate check grid tiles that aren't 100% inside the area.
What I don't like about this approach is answering "How large should the grid tiles be?" Too large, and efficiency may become a real problem. Too small, and the grid takes up tons of memory if the game world is large enough (and can become ridiculous if the game is 3d). There may not even be a suitable golden mean.
The obvious solution to the above is to make a large grid with some kind of intelligent subdivision, like a pseudo tree-structure. And it is at this point I know for sure I am far into premature optimization. (Then there are proper dynamic quad/octrees, but that's even more complex to code and I'm not even confident it will perform any better.)
So my question is: Is there a standard solution to the above problem? Something, in the lines of an STL container, that can just store any object with a coordinate, and retreive a list of objects within a certain area? It doesn't have to be different than what I described above, as long as it's something that has been thought out and deemed "good enough" for a start.
Bonus points if there is an implementation of the algorithm in Python, but C would also do. | false | 3,691,278 | 0 | 0 | 0 | 0 | I don't know anything about games programming, but I would imagine (based on intuition and what I've read in the past) that a complete grid will get very inefficient for large spaces; you'll lose out in both storage, and also in time, because you'll melt the cache.
STL containers are fundamentally one-dimensional. Yes, things like set and map allow you to define arbitrary sort relationships, but it's still ordered in only one dimension. If you want to do better, you'll probably need to use a quad-tree, a kd-tree, or something like that. | 0 | 293 | 0 | 2 | 2010-09-11T14:08:00.000 | python,c,containers | A container for accessing contents by 2d/3d coordinates | 0 | 2 | 3 | 3,691,977 | 1 |
0 | 0 | How can I place an image in a Tkinter GUI using the python standard library? | false | 3,698,900 | 0 | 0 | 0 | 0 | You can Built-In the images on the code encoding it on Base64 | 0 | 543 | 0 | 0 | 2010-09-13T08:45:00.000 | python,tkinter | Putting images in a Tkinter | 0 | 1 | 2 | 3,713,622 | 1 |
0 | 0 | In my application i have text control.
I want my text ctrl should be read only but when some one right click on this he is able to copy the value from that ctrl and he can paste that value in other text control.
If i made my text control read only with wx.TE_READONLY then copy/paste is not working.
Is there any requirement to handle other type of wx event or i have to set more type of wx style flags while creating the text control object.
Thanks in advance. | false | 3,710,751 | 0.066568 | 0 | 0 | 1 | We should bind wx.EVT_TEXT_COPY and wx.EVT_TEXT_PASTE with text control.
one can copy and paste data from text ctrl although text ctrl is read only mode. | 0 | 8,427 | 0 | 1 | 2010-09-14T16:13:00.000 | python,wxpython | how to create read only text ctrl but support copy paste event | 0 | 1 | 3 | 3,716,517 | 1 |
0 | 0 | How is Python able to call C++ objects when the interpreter is C and has been built w/ a C compiler? | false | 3,712,125 | 0.132549 | 1 | 0 | 2 | C++ can interoperate with C by extern "C" declarations. | 1 | 1,508 | 0 | 8 | 2010-09-14T19:16:00.000 | c++,python,boost-python | How does Boost.Python work? | 0 | 1 | 3 | 3,712,249 | 1 |
0 | 0 | I have a Python/wxPython program where the GUI is the main thread and I use another thread to load data from a file. Sometimes the files are big and slow to load so I use a wxPulse dialog to indicate progress.
As I load the file, I count the number of lines that have been read in the counting thread, and I display this count in the wxPulse dialog in the main thread. I get the count in the main thread by reading the same variable that is being written to by the loading thread.
Is this "thread safe"? Could this somehow cause problems? I've been doing it for awhile and it has been fine so far.
PS. I know I could use a queue to transfer the count, but I'm lazy and don't want to if I don't have to. | false | 3,714,613 | 0.119427 | 0 | 0 | 3 | In normal python this will be safe as all access to variables are protected by the GIL(Global Interpreter Lock) this means that all access to a variable are syncronised so only one thread can do this at a time. The only issue is as @Eloff noted if you need to read more than one value and need them to be consistent - you will need to design in some control of access in this case. | 1 | 2,094 | 0 | 6 | 2010-09-15T04:12:00.000 | python,thread-safety | Python: safe to read values from an object in a thread? | 0 | 5 | 5 | 3,716,794 | 1 |
0 | 0 | I have a Python/wxPython program where the GUI is the main thread and I use another thread to load data from a file. Sometimes the files are big and slow to load so I use a wxPulse dialog to indicate progress.
As I load the file, I count the number of lines that have been read in the counting thread, and I display this count in the wxPulse dialog in the main thread. I get the count in the main thread by reading the same variable that is being written to by the loading thread.
Is this "thread safe"? Could this somehow cause problems? I've been doing it for awhile and it has been fine so far.
PS. I know I could use a queue to transfer the count, but I'm lazy and don't want to if I don't have to. | false | 3,714,613 | 0.039979 | 0 | 0 | 1 | It's quite safe.
When the count increases from n to n+1 the "n+1 object" is created and then count is switched from referring to the "n object" to the new "n+1 object".
There is no stage that count is referring to something other than the "n object" or the "n+1 object" | 1 | 2,094 | 0 | 6 | 2010-09-15T04:12:00.000 | python,thread-safety | Python: safe to read values from an object in a thread? | 0 | 5 | 5 | 3,714,773 | 1 |
0 | 0 | I have a Python/wxPython program where the GUI is the main thread and I use another thread to load data from a file. Sometimes the files are big and slow to load so I use a wxPulse dialog to indicate progress.
As I load the file, I count the number of lines that have been read in the counting thread, and I display this count in the wxPulse dialog in the main thread. I get the count in the main thread by reading the same variable that is being written to by the loading thread.
Is this "thread safe"? Could this somehow cause problems? I've been doing it for awhile and it has been fine so far.
PS. I know I could use a queue to transfer the count, but I'm lazy and don't want to if I don't have to. | true | 3,714,613 | 1.2 | 0 | 0 | 8 | Generally as long as...
You only have one thread writing to it, and...
It's not important that the count be kept precisely in sync with the displayed value...
it's fine. | 1 | 2,094 | 0 | 6 | 2010-09-15T04:12:00.000 | python,thread-safety | Python: safe to read values from an object in a thread? | 0 | 5 | 5 | 3,714,627 | 1 |
0 | 0 | I have a Python/wxPython program where the GUI is the main thread and I use another thread to load data from a file. Sometimes the files are big and slow to load so I use a wxPulse dialog to indicate progress.
As I load the file, I count the number of lines that have been read in the counting thread, and I display this count in the wxPulse dialog in the main thread. I get the count in the main thread by reading the same variable that is being written to by the loading thread.
Is this "thread safe"? Could this somehow cause problems? I've been doing it for awhile and it has been fine so far.
PS. I know I could use a queue to transfer the count, but I'm lazy and don't want to if I don't have to. | false | 3,714,613 | 0.07983 | 0 | 0 | 2 | This is fine because you have only one writer thread. Read only operations are always thread-safe. The exception to this arises when you are reading more than one related value and expecting some form of consistency between them. Since writes can happen at any time, reads of multiple values may not be consistent and indeed may not even have any sensible program state at all. In this case, locks are used to make the multiple reads appear to happen as a single atomic operation exclusive to any writes. | 1 | 2,094 | 0 | 6 | 2010-09-15T04:12:00.000 | python,thread-safety | Python: safe to read values from an object in a thread? | 0 | 5 | 5 | 3,714,663 | 1 |
0 | 0 | I have a Python/wxPython program where the GUI is the main thread and I use another thread to load data from a file. Sometimes the files are big and slow to load so I use a wxPulse dialog to indicate progress.
As I load the file, I count the number of lines that have been read in the counting thread, and I display this count in the wxPulse dialog in the main thread. I get the count in the main thread by reading the same variable that is being written to by the loading thread.
Is this "thread safe"? Could this somehow cause problems? I've been doing it for awhile and it has been fine so far.
PS. I know I could use a queue to transfer the count, but I'm lazy and don't want to if I don't have to. | false | 3,714,613 | 0 | 0 | 0 | 0 | It's safe only because it's not especially critical. Weird things like the value not updating when it should won't matter. It is very hard to get a definitive answer on what happens when you pretend a single int that's being read and written to is "atomic", as it depends on the exact architecture and a bunch of other things. But it won't do anything worse than give the wrong number sometimes, so go ahead... or use a queue. :) | 1 | 2,094 | 0 | 6 | 2010-09-15T04:12:00.000 | python,thread-safety | Python: safe to read values from an object in a thread? | 0 | 5 | 5 | 3,714,667 | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.