Web Development
int64 0
1
| Data Science and Machine Learning
int64 0
1
| Question
stringlengths 35
6.31k
| is_accepted
bool 2
classes | Q_Id
int64 5.14k
40.5M
| Score
float64 -1
1.2
| Other
int64 0
1
| Database and SQL
int64 0
1
| Users Score
int64 -6
163
| Answer
stringlengths 19
4.91k
| Python Basics and Environment
int64 0
1
| ViewCount
int64 12
475k
| System Administration and DevOps
int64 0
1
| Q_Score
int64 0
346
| CreationDate
stringlengths 23
23
| Tags
stringlengths 6
68
| Title
stringlengths 12
138
| Networking and APIs
int64 0
1
| Available Count
int64 1
31
| AnswerCount
int64 1
35
| A_Id
int64 5.3k
72.3M
| GUI and Desktop Applications
int64 1
1
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | 0 | I am trying really hard to make a sliding frame containing widgets in tkinter in python. There is this frame inside a big window with different widgets. And as soon as i click on the next button on that frame the frame should slowly slide towards the left and vanish ultimately. As soon as it vanishes, i want new frame with widgets to come sliding towards right.
What should i do?
Anticipating your suggestions and ideas. | true | 2,882,060 | 1.2 | 0 | 0 | 0 | How you do it depends on the geometry manager, but the basic idea is simply to set the width of the frame to smaller and smaller values until it has a width of zero. You don't need a loop though -- the code is already running in the event loop, so take advantage of that. Use 'after' to schedule a job that changes the width a tiny bit, then reschedules itself for a few milliseconds later. | 0 | 1,113 | 0 | 0 | 2010-05-21T12:38:00.000 | python,user-interface,tkinter,frame,sliding | Creating a sliding frame containing widgets in tkinter in python | 0 | 1 | 1 | 2,896,537 | 1 |
0 | 0 | Could someone show me how I could return a value from a wxPython Frame? When the use clicks close, I popup a message dialog asking him a question. I would like to return the return code of this message dialog to my calling function.
Thanks | false | 2,889,255 | 0 | 0 | 0 | 0 | I don't think a wxFrame can return a value since it is not modal. If you don't need to use a wxFrame, then a modal dialog could work for you. If you really need a frame, I'd consider using a custom event.
It would go something like this:
(1) User clicks to close the wxFrame
(2) You override OnClose (or something like that) to pop up a dialog to ask the user a question
(3) Create and post the custom event
(4) Close the wxFrame
(5) Some other code processes your custom event | 0 | 7,486 | 0 | 7 | 2010-05-22T18:27:00.000 | python,wxpython | Return value from wxPython Frame | 0 | 1 | 8 | 2,893,253 | 1 |
0 | 0 | I have a working QListView, but from the documentation, I can't figure out how to get a signal to fire with the index of the newly selected item. Any ideas? | false | 2,911,991 | 0.099668 | 0 | 0 | 1 | Imho, an easier way to achieve this would be to use a QListWidget instead of a QListView, this way you could use the itemClicked signal, which sends the selected item to the callback function. | 0 | 3,622 | 0 | 1 | 2010-05-26T10:16:00.000 | python,pyqt4,qlistview | clicked() signal for QListView in PyQt4 | 0 | 1 | 2 | 2,912,399 | 1 |
0 | 0 | I'm rewriting this post to clarify some things and provide a full class definition for the Virtual List I'm having trouble with. The class is defined like so:
from wx import ListCtrl, LC_REPORT, LC_VIRTUAL, LC_HRULES, LC_VRULES, \
EVT_LIST_COL_CLICK, EVT_LIST_CACHE_HINT, EVT_LIST_COL_RIGHT_CLICK, \
ImageList, IMAGE_LIST_SMALL, Menu, MenuItem, NewId, ITEM_CHECK, Frame, \
EVT_MENU
class VirtualList(ListCtrl):
def __init__(self, parent, datasource = None,
style = LC_REPORT | LC_VIRTUAL | LC_HRULES | LC_VRULES):
ListCtrl.__init__(self, parent, style = style)
self.columns = []
self.il = ImageList(16, 16)
self.Bind(EVT_LIST_CACHE_HINT, self.CheckCache)
self.Bind(EVT_LIST_COL_CLICK, self.OnSort)
if datasource is not None:
self.datasource = datasource
self.Bind(EVT_LIST_COL_RIGHT_CLICK, self.ShowAvailableColumns)
self.datasource.list = self
self.Populate()
def SetDatasource(self, datasource):
self.datasource = datasource
def CheckCache(self, event):
self.datasource.UpdateCache(event.GetCacheFrom(), event.GetCacheTo())
def OnGetItemText(self, item, col):
return self.datasource.GetItem(item, self.columns[col])
def OnGetItemImage(self, item):
return self.datasource.GetImg(item)
def OnSort(self, event):
self.datasource.SortByColumn(self.columns[event.Column])
self.Refresh()
def UpdateCount(self):
self.SetItemCount(self.datasource.GetCount())
def Populate(self):
self.UpdateCount()
self.datasource.MakeImgList(self.il)
self.SetImageList(self.il, IMAGE_LIST_SMALL)
self.ShowColumns()
def ShowColumns(self):
for col, (text, visible) in enumerate(self.datasource.GetColumnHeaders()):
if visible:
self.columns.append(text)
self.InsertColumn(col, text, width = -2)
def Filter(self, filter):
self.datasource.Filter(filter)
self.UpdateCount()
self.Refresh()
def ShowAvailableColumns(self, evt):
colMenu = Menu()
self.id2item = {}
for idx, (text, visible) in enumerate(self.datasource.columns):
id = NewId()
self.id2item[id] = (idx, visible, text)
item = MenuItem(colMenu, id, text, kind = ITEM_CHECK)
colMenu.AppendItem(item)
EVT_MENU(colMenu, id, self.ColumnToggle)
item.Check(visible)
Frame(self, -1).PopupMenu(colMenu)
colMenu.Destroy()
def ColumnToggle(self, evt):
toggled = self.id2item[evt.GetId()]
if toggled[1]:
idx = self.columns.index(toggled[2])
self.datasource.columns[toggled[0]] = (self.datasource.columns[toggled[0]][0], False)
self.DeleteColumn(idx)
self.columns.pop(idx)
else:
self.datasource.columns[toggled[0]] = (self.datasource.columns[toggled[0]][0], True)
idx = self.datasource.GetColumnHeaders().index((toggled[2], True))
self.columns.insert(idx, toggled[2])
self.InsertColumn(idx, toggled[2], width = -2)
self.datasource.SaveColumns()
I've added functions that allow for Column Toggling which facilitate my description of the issue I'm encountering. On the 3rd instance of this class in my application the Column at Index 1 will not display String values. Integer values are displayed properly. If I add print statements to my OnGetItemText method the values show up in my console properly. This behavior is not present in the first two instances of this class, and my class does not contain any type checking code with respect to value display.
It was suggested by someone on the wxPython users' group that I create a standalone sample that demonstrates this issue if I can. I'm working on that, but have not yet had time to create a sample that does not rely on database access. Any suggestions or advice would be most appreciated. I'm tearing my hair out on this one. | false | 2,914,816 | 0 | 0 | 0 | 0 | Are you building on the wxPython demo code for virtual list controls? There are a couple of bookkeeping things you need to do, like set the ItemCount property.
One comment about your OnGetItemText method: Since there's no other return statement, it will return None if data is None, so your test has no effect.
How about return data or "" instead? | 0 | 1,183 | 0 | 2 | 2010-05-26T16:17:00.000 | python,wxpython,listctrl | wxPython ListCtrl Column Ignores Specific Fields | 0 | 2 | 2 | 2,915,460 | 1 |
0 | 0 | I'm rewriting this post to clarify some things and provide a full class definition for the Virtual List I'm having trouble with. The class is defined like so:
from wx import ListCtrl, LC_REPORT, LC_VIRTUAL, LC_HRULES, LC_VRULES, \
EVT_LIST_COL_CLICK, EVT_LIST_CACHE_HINT, EVT_LIST_COL_RIGHT_CLICK, \
ImageList, IMAGE_LIST_SMALL, Menu, MenuItem, NewId, ITEM_CHECK, Frame, \
EVT_MENU
class VirtualList(ListCtrl):
def __init__(self, parent, datasource = None,
style = LC_REPORT | LC_VIRTUAL | LC_HRULES | LC_VRULES):
ListCtrl.__init__(self, parent, style = style)
self.columns = []
self.il = ImageList(16, 16)
self.Bind(EVT_LIST_CACHE_HINT, self.CheckCache)
self.Bind(EVT_LIST_COL_CLICK, self.OnSort)
if datasource is not None:
self.datasource = datasource
self.Bind(EVT_LIST_COL_RIGHT_CLICK, self.ShowAvailableColumns)
self.datasource.list = self
self.Populate()
def SetDatasource(self, datasource):
self.datasource = datasource
def CheckCache(self, event):
self.datasource.UpdateCache(event.GetCacheFrom(), event.GetCacheTo())
def OnGetItemText(self, item, col):
return self.datasource.GetItem(item, self.columns[col])
def OnGetItemImage(self, item):
return self.datasource.GetImg(item)
def OnSort(self, event):
self.datasource.SortByColumn(self.columns[event.Column])
self.Refresh()
def UpdateCount(self):
self.SetItemCount(self.datasource.GetCount())
def Populate(self):
self.UpdateCount()
self.datasource.MakeImgList(self.il)
self.SetImageList(self.il, IMAGE_LIST_SMALL)
self.ShowColumns()
def ShowColumns(self):
for col, (text, visible) in enumerate(self.datasource.GetColumnHeaders()):
if visible:
self.columns.append(text)
self.InsertColumn(col, text, width = -2)
def Filter(self, filter):
self.datasource.Filter(filter)
self.UpdateCount()
self.Refresh()
def ShowAvailableColumns(self, evt):
colMenu = Menu()
self.id2item = {}
for idx, (text, visible) in enumerate(self.datasource.columns):
id = NewId()
self.id2item[id] = (idx, visible, text)
item = MenuItem(colMenu, id, text, kind = ITEM_CHECK)
colMenu.AppendItem(item)
EVT_MENU(colMenu, id, self.ColumnToggle)
item.Check(visible)
Frame(self, -1).PopupMenu(colMenu)
colMenu.Destroy()
def ColumnToggle(self, evt):
toggled = self.id2item[evt.GetId()]
if toggled[1]:
idx = self.columns.index(toggled[2])
self.datasource.columns[toggled[0]] = (self.datasource.columns[toggled[0]][0], False)
self.DeleteColumn(idx)
self.columns.pop(idx)
else:
self.datasource.columns[toggled[0]] = (self.datasource.columns[toggled[0]][0], True)
idx = self.datasource.GetColumnHeaders().index((toggled[2], True))
self.columns.insert(idx, toggled[2])
self.InsertColumn(idx, toggled[2], width = -2)
self.datasource.SaveColumns()
I've added functions that allow for Column Toggling which facilitate my description of the issue I'm encountering. On the 3rd instance of this class in my application the Column at Index 1 will not display String values. Integer values are displayed properly. If I add print statements to my OnGetItemText method the values show up in my console properly. This behavior is not present in the first two instances of this class, and my class does not contain any type checking code with respect to value display.
It was suggested by someone on the wxPython users' group that I create a standalone sample that demonstrates this issue if I can. I'm working on that, but have not yet had time to create a sample that does not rely on database access. Any suggestions or advice would be most appreciated. I'm tearing my hair out on this one. | true | 2,914,816 | 1.2 | 0 | 0 | 0 | There's a problem with the native object in Windows. If GetImg returns None instead of -1 the list has a problem with column 1 for some reason. That from Robin over on the Google Group post for this issue. | 0 | 1,183 | 0 | 2 | 2010-05-26T16:17:00.000 | python,wxpython,listctrl | wxPython ListCtrl Column Ignores Specific Fields | 0 | 2 | 2 | 2,954,639 | 1 |
0 | 0 | I have a window with 2 QTableWidgets, having their scrolling synchronized.
The 1st one usually has horizontal scroll, while the 2nd usually (automatically) not.
In order for them to show consistent data (row against row) I make the 2nd have the scroll (through property HorizontalScrollBar -> AlwaysOn).
But sometimes the 1st table doesn't have the scroll. What's event worse, it may have it or not depending on the window size (when making window wider the scroll disappears). As far as I see there's no signal for resize of window or control (widget).
I can, of course, use some constantly running timer to check if 1st table has scroll, but I wounder if there's more pure solution.
Thanks! | true | 2,916,052 | 1.2 | 0 | 0 | 0 | The answer was to reimplement the resizeEvent and check table.horizontalScrollBar().isVisible() | 0 | 695 | 0 | 0 | 2010-05-26T19:20:00.000 | python,pyqt4 | Track window/control resize in PyQt? | 0 | 1 | 1 | 3,012,347 | 1 |
1 | 0 | I have an application that displays some HTML in a QWebview, which references images on the local file system. This works fine directly running the python. When compiling via py2exe, the images no longer load. Google doesn't seem to know the answer, any ideas? | false | 2,924,781 | 0.379949 | 0 | 0 | 2 | Only png support is native, jpg (and others) is supplied via plugins.
Don't recall the exact paths (and I don't know your platform) but search for the PyQt plugins folder and:
Copy the plugins folder to: $yourprogram/PyQt4/plugins (along with qt.conf)
Edit qt.conf, and change prefix to $yourprogram/PyQt4
You might also need to convince py2exe to also include this folder (verbatim). | 0 | 1,402 | 0 | 1 | 2010-05-27T20:46:00.000 | python,pyqt4,py2exe,qwebview | Images not loading in QWebview in PyQt4 in py2exe | 0 | 1 | 1 | 2,925,711 | 1 |
0 | 0 | I am writing a wxPython application that remains open after closing all of its windows - so you can still drag & drop new files onto the OSX dock icon (I do this with myApp.SetExitOnFrameDelete(False)).
Unfortunately if I close all the windows, the OSX menubar will only contain a "Help" menu. I would like to add at least a File/Open menu item, or just keep the menubar of the main window. Is this somehow possible in wxPython?
In fact, I would be happy with a non-wxPython hack as well (for example, setting the menu in pyobjc, but running the rest of the GUI in wxPython). wxPython development in OSX is such a hack anyway ;)
UPDATE: I managed to solve this problem using the tip from Lyndsey Ferguson. Here's what I have done:
On startup I create a window which I show and hide immediately. I set its position to (-10000,-10000) so that it does not flicker on the screen (aargh, what a dirty hack!)
I create an empty EVT_CLOSE event handler in that window so that it cannot be closed.
It seems that destroying a window resets the OSX menu, but hiding does not... So when the last window is closed, I need to show and hide this window again (hiding is necessary so that the user cannot switch to this window using the Window menu or Cmd-`)
Yeah, this is really ugly... I will be very grateful if someone comes up with a prettier solution.
UPDATE 2: Actually it can be solved in a much easier way: if we do not close the last window, only hide it. And ensure that it does not respond to menu events anymore. | true | 2,934,435 | 1.2 | 0 | 0 | 1 | Can you create a hidden window that is offscreen somewhere? It is a hack, but I remember having to do a lot of hacks to make my wxPython-based application work correctly on Mac OS X.
Note:You'll have to disable the close button and set up that hidden window so that it doesn't show up in the Window menu.
Aside:Have you considered factoring out your GUI portion of your Python application and using PyObjC on Mac OS X? You'll get more native behaviours... | 0 | 1,471 | 1 | 5 | 2010-05-29T09:02:00.000 | python,macos,wxpython,pyobjc | How to change the OSX menubar in wxPython without any opened window? | 0 | 1 | 2 | 2,958,571 | 1 |
0 | 0 | I have a QWebview in a grid layout, along with other widgets. When the user resizes the window, the QWebview doesn't resize, but the other widgets do. How can I make the QWebview resize correctly? | false | 2,938,874 | 0 | 0 | 0 | 0 | in the dialog class's resizeEvent, one that extends QDialog, call webView->setGeometry, and this->resize, this->update.
hint: check if size changed via the QResizeEvent *ptr | 0 | 1,113 | 0 | 0 | 2010-05-30T13:51:00.000 | python,grid,resize,pyqt4,qwebview | PyQT4 QWebView not resizing correctly | 0 | 1 | 2 | 6,977,293 | 1 |
0 | 0 | I'm developing a media player. Right now it's a simple window with a button to load .wav files. The problem is I would like to implement a pause button now. But, when playing a audio file the GUI isn't accessible again (no buttons can be pushed) till the file is done playing. How can I make the GUI dynamic while an audio file is playing?
I'm using PyAudio, and their implementation doesn't allow this. | false | 2,939,224 | 0.26052 | 0 | 0 | 4 | Probably you have to use threads for that. You have to play your audio file in a different thread than the gui mainloop so that the GUI keeps responding user input.
IMHO, wxpython is not so complicated and has some utility functions that would help to do what you want. Check the wxpython demo, you have several examples there. | 0 | 3,328 | 0 | 0 | 2010-05-30T15:30:00.000 | python,tkinter,media,pyaudio,audio-player | Python/Tkinter Audio Player | 0 | 1 | 3 | 2,939,414 | 1 |
0 | 0 | I'm making a small script in python with ttk and I have a problem where a function runs where it shouldn't. The button code looks as follows:
btReload = ttk.Button(treeBottomUI, text="Reload", width=17, command=loadModelTree(treeModel))
btReload.pack(side="left")
and the function is as this:
def loadModelTree(tree):
print ("Loading models...")
allModels = os.listdir(confModPath)
for chunk in allModels:
...
For some reason, the function runs without the button being pressed. Why? | false | 2,947,817 | 0.197375 | 0 | 0 | 2 | Markus, yes, that's the right solution, but it is not because you can't use multi-argument commands in widget callouts. Consider, in your original code, ...command=loadModelTree(treeModel)... is an invocation of the method. Lambda allows you to abstract the command so you can have an arbitrary number of arguments without confusing the interpreter by invoking it, e.g., ...command=lambda arg1=myarg1, arg2=myarg2, arg3=myarg3: myCallout(arg1, arg2, arg3)....
I hope that makes what is going on a bit clearer. | 0 | 3,407 | 0 | 1 | 2010-06-01T06:58:00.000 | python,function,button,ttk | Python ttk.Button -command, runs without button being pressed | 0 | 2 | 2 | 11,642,028 | 1 |
0 | 0 | I'm making a small script in python with ttk and I have a problem where a function runs where it shouldn't. The button code looks as follows:
btReload = ttk.Button(treeBottomUI, text="Reload", width=17, command=loadModelTree(treeModel))
btReload.pack(side="left")
and the function is as this:
def loadModelTree(tree):
print ("Loading models...")
allModels = os.listdir(confModPath)
for chunk in allModels:
...
For some reason, the function runs without the button being pressed. Why? | false | 2,947,817 | 0.099668 | 0 | 0 | 1 | Well, as I found the answer, I'll answer my own question.
It appers that ttk.button commands does not support sending arguments to functions so the work around is to do as follows:
btReload = ttk.Button(treeBottomUI, text="Reload", width=17, command=lambda i=treeModel: loadModelTree(i))
btReload.pack(side="left")
Simple as pie! | 0 | 3,407 | 0 | 1 | 2010-06-01T06:58:00.000 | python,function,button,ttk | Python ttk.Button -command, runs without button being pressed | 0 | 2 | 2 | 2,947,926 | 1 |
0 | 0 | I am trying to print the contents of a python tkinter canvas. I have tried using the postscript method of canvas to create a postscript file, but I get a blank page. I know this is because I have embedded widgets, and these do not get rendered by the postscript method.
Before I rewrite my program to create a more printer-friendly layout, can someone suggest a way to approach this problem? All of the programming books I have ever read approach the problem of sending output to a printer with a bit of hand-waving, something along the lines of: "It's a difficult problem that depends on interacting with the operating system." I also have a hard time finding resources about this because of all the pages related to printing to the screen.
I am using Python 2.6, on Ubuntu 9.04. | false | 2,951,530 | 0 | 0 | 0 | 0 | I think your butting up to the limits of Tkinter. If not for the widgets, another method is to draw the same image on a PIL image-draw object as the two have similar APIs.
A hacky workaround would be to programatically take a screen grab of the window area you want using ImageGrab in PIL.
wxPython is a decent alternative. Personally I prefer Qt, it certainly has excellent printer support. Also the Graphics View framework is outstanding. | 0 | 5,306 | 0 | 5 | 2010-06-01T16:29:00.000 | python,printing,tkinter | Printing python tkinter output | 0 | 1 | 3 | 3,214,960 | 1 |
0 | 0 | I'm going to start on a long (~1-year) programming project in Python. I want to use wxPython for my GUI (supports 2.6), but I also want to use 3.1 for the rest of the project (to start using the 3.x syntax).
Is there any way for me to design a project that mixes 2.x and 3.x modules? Or should I just bite the bullet and use either 2.x (preferred, since I really want to learn wxPython) or 3.x throughout?
Thanks,
Mike | true | 2,951,982 | 1.2 | 0 | 0 | 3 | Python 2 and 3 are not that different. If you have learned Python 2 well, it will be a matter of minutes to get acquainted with Python 3. The official recommendation says that you should use Python 2.6 (the current version) and try to be forward-compatible. Python 3 is currently not an option for large projects as virtually none of the popular packages have been translated yet. But development of Python 2 and 3 will continue in parallel for a long time, so you won't lose much by not using Python 3. You can import many syntactical features of 3 (Unicode string literals, division, print function, absolute imports) using the __future__ module, and the standard library remains mostly the same. So I'd recommend using Python 2. | 1 | 4,940 | 0 | 5 | 2010-06-01T17:43:00.000 | python,python-3.x,python-2.x | Can one Python project use both 2.x and 3.x code? | 0 | 2 | 3 | 2,952,037 | 1 |
0 | 0 | I'm going to start on a long (~1-year) programming project in Python. I want to use wxPython for my GUI (supports 2.6), but I also want to use 3.1 for the rest of the project (to start using the 3.x syntax).
Is there any way for me to design a project that mixes 2.x and 3.x modules? Or should I just bite the bullet and use either 2.x (preferred, since I really want to learn wxPython) or 3.x throughout?
Thanks,
Mike | false | 2,951,982 | 0.132549 | 0 | 0 | 2 | mixing the ability to use wxPython (2.x) + with learning new syntax (3.x)
Don't "mix".
Write Python 2. Get it to work.
Play with Python 3 separately. Don't "mix".
When the various packages and modules are available in Python 3, use the 2to3 conversion to create Python 3. You'll find some small problems. Fix your Python 2 so that your package works in Python 2 and also works after the conversion.
Then, you can drop support for Python 2 and focus on Python 3.
Don't "mix". | 1 | 4,940 | 0 | 5 | 2010-06-01T17:43:00.000 | python,python-3.x,python-2.x | Can one Python project use both 2.x and 3.x code? | 0 | 2 | 3 | 3,026,057 | 1 |
0 | 0 | Is there a signal that is emitted when a window/dialog is presented in GTK+?
Example: when issuing this command to the GTK widget dialog:
dialog.present()
is there a resulting signal? Or is there any signal that denotes the "showing" of a window/dialog? | false | 2,954,412 | 0.099668 | 0 | 0 | 1 | I believe the "show" signal (inherited from Widget) will do this. | 0 | 317 | 0 | 0 | 2010-06-02T01:16:00.000 | python,c,gtk | gtk+ signal emitted when window/dialog is "presented" | 0 | 1 | 2 | 2,954,934 | 1 |
0 | 0 | I need to create a simple windows based GUI for a desktop application that will be downloaded by end users. The application is written in python and will be packaged as an installer or executable.
The functionality I need is simple - selecting from various lists, showing progress bars, etc. No animations, sprites, or other taxing/exotic things.
Seems there are quite a few options for Python GUI libraries (Tk, QT, wxPython, Gtk, etc). What do you recommend that:
Is easy to learn and maintain
Can be cleanly packaged using py2exe or something similar
Looks nice
[Update] For what it's worth I ended up going with tkinter. It's fairly well documented, can be made to look nice (mainly, use native fonts), and most importantly ships with Python so there's nothing extra to worry about. wxpython also looked good, but the download was 10M or so, and I didn't want to add that extra weight to the packages I distribute. | false | 2,962,194 | 0.119427 | 0 | 0 | 3 | The most beautiful one that I can suggest is PyQt (almost native), otherwise a good idea would be using directly IronPython that is native .net code.
Anyway nothing beats tkinter for multi-platformness and packaging-friendliness. | 0 | 4,853 | 0 | 3 | 2010-06-02T22:54:00.000 | python,user-interface,wxpython,tkinter | Python: Attractive, clean, packagable windows GUI library | 0 | 4 | 5 | 2,962,443 | 1 |
0 | 0 | I need to create a simple windows based GUI for a desktop application that will be downloaded by end users. The application is written in python and will be packaged as an installer or executable.
The functionality I need is simple - selecting from various lists, showing progress bars, etc. No animations, sprites, or other taxing/exotic things.
Seems there are quite a few options for Python GUI libraries (Tk, QT, wxPython, Gtk, etc). What do you recommend that:
Is easy to learn and maintain
Can be cleanly packaged using py2exe or something similar
Looks nice
[Update] For what it's worth I ended up going with tkinter. It's fairly well documented, can be made to look nice (mainly, use native fonts), and most importantly ships with Python so there's nothing extra to worry about. wxpython also looked good, but the download was 10M or so, and I didn't want to add that extra weight to the packages I distribute. | false | 2,962,194 | 0.039979 | 0 | 0 | 1 | From using both wxPython and TKinter, I'd say wxPython looks nicer and is easy to learn.
Although you said you are planning on using the program for Windows, it's worth mentioning that I've had problems with TKinter on Mac not working correctly. | 0 | 4,853 | 0 | 3 | 2010-06-02T22:54:00.000 | python,user-interface,wxpython,tkinter | Python: Attractive, clean, packagable windows GUI library | 0 | 4 | 5 | 2,962,216 | 1 |
0 | 0 | I need to create a simple windows based GUI for a desktop application that will be downloaded by end users. The application is written in python and will be packaged as an installer or executable.
The functionality I need is simple - selecting from various lists, showing progress bars, etc. No animations, sprites, or other taxing/exotic things.
Seems there are quite a few options for Python GUI libraries (Tk, QT, wxPython, Gtk, etc). What do you recommend that:
Is easy to learn and maintain
Can be cleanly packaged using py2exe or something similar
Looks nice
[Update] For what it's worth I ended up going with tkinter. It's fairly well documented, can be made to look nice (mainly, use native fonts), and most importantly ships with Python so there's nothing extra to worry about. wxpython also looked good, but the download was 10M or so, and I didn't want to add that extra weight to the packages I distribute. | false | 2,962,194 | 0.039979 | 0 | 0 | 1 | I've used wxPython in the past (For Mac/Windows deployments). It has worked good. And it looks nicer than Tk :) | 0 | 4,853 | 0 | 3 | 2010-06-02T22:54:00.000 | python,user-interface,wxpython,tkinter | Python: Attractive, clean, packagable windows GUI library | 0 | 4 | 5 | 2,962,200 | 1 |
0 | 0 | I need to create a simple windows based GUI for a desktop application that will be downloaded by end users. The application is written in python and will be packaged as an installer or executable.
The functionality I need is simple - selecting from various lists, showing progress bars, etc. No animations, sprites, or other taxing/exotic things.
Seems there are quite a few options for Python GUI libraries (Tk, QT, wxPython, Gtk, etc). What do you recommend that:
Is easy to learn and maintain
Can be cleanly packaged using py2exe or something similar
Looks nice
[Update] For what it's worth I ended up going with tkinter. It's fairly well documented, can be made to look nice (mainly, use native fonts), and most importantly ships with Python so there's nothing extra to worry about. wxpython also looked good, but the download was 10M or so, and I didn't want to add that extra weight to the packages I distribute. | true | 2,962,194 | 1.2 | 0 | 0 | 3 | tkinter's major advantage (IMHO!) is that it comes with Python (at least on Windows). It looks ugly, and there's no progress bar or something like that (at least not builtin). Being a thin wrapper around Tk, its API doesn't feel very elegant or intuitive. However, there are quite a few good Tkinter resources on the web so learning it is not necessarily a pain.
For any serious GUI attempts, I'd go for wxPython as well. I don't know about packaging, though. But I wouldn't expect any problems. | 0 | 4,853 | 0 | 3 | 2010-06-02T22:54:00.000 | python,user-interface,wxpython,tkinter | Python: Attractive, clean, packagable windows GUI library | 0 | 4 | 5 | 2,962,228 | 1 |
0 | 0 | I want to start learning OpenGL but I don't really want to have to learn another language to do it. I already am pretty proficient in python and enjoy the language. I just want to know how close it is to the regular api? Will I be able to pretty easily follow tutorials and books without too much trouble?
I know C++ gives better performance, but for just learning can I go wrong with PyOpenGL? | true | 2,962,571 | 1.2 | 0 | 0 | 13 | With the caveat that I have done very little OpenGL programming myself, I believe that for the purposes of learning, PyOpenGL is a good choice. The main reason is that PyOpenGL, like most other OpenGL wrappers, is just that: a thin wrapper around the OpenGL API.
One large benefit of PyOpenGL is that while in C you have to worry about calling the proper glVertex3{dfiX} command, Python allows you to just write glVertex3(x,y,z) without worrying about telling Python what type of argument you passed in. That might not sound like a big deal, but it's often much simpler to use Python's duck-typing instead of being overly concerned with static typing.
The OpenGL methods are almost completely all wrapped into Python methods, so while you'll be writing in Python, the algorithms and method calls you'll use are identical to writing OpenGL in any other language. But since you're writing in Python, you'll have many fewer opportunities to make "silly" mistakes with proper pointer usage, memory management, etc. that would just eat up your time if you were to study the API in C or C++, for instance. | 1 | 3,573 | 0 | 9 | 2010-06-03T00:28:00.000 | python,graphics,pyopengl | Is PyOpenGL a good place to start learning opengl programming? | 0 | 2 | 2 | 2,962,599 | 1 |
0 | 0 | I want to start learning OpenGL but I don't really want to have to learn another language to do it. I already am pretty proficient in python and enjoy the language. I just want to know how close it is to the regular api? Will I be able to pretty easily follow tutorials and books without too much trouble?
I know C++ gives better performance, but for just learning can I go wrong with PyOpenGL? | false | 2,962,571 | 0 | 0 | 0 | 0 | PyOpenGL
I don't think it is a good choice. In my opinon in C/C++ it is easier to play around around with your OpenGL code - start with simple app, then add shader, then add some geometry functions, make a texture/geometry generator, build scene via CSG, etc. You know - to have fun, play around with code, experiment and learn something in process. I honestly just don't see myself doing this in python. Surely it is possible to do OpenGL programming in Python, but I see no reason to actually do it. Plus several OpenGL functions take memory pointers as arguments, and although there probably a class (or dozen of alternatives) for that case, I don't see a reason to use them when a traditional way of doing things is available in C/C++, especially when I think about amount of wrappers python code uses to pass vector or array of those into OpenGL function. It just looks like making things more complicated without a real reason to do that. Plus there is a noticeable performance drop, especially when you use "RAW" OpenGL.
Besides, if you're going to make games, it is very likely that you'll have to use C++ or some other "non-python" language.
P.S. I've done enough OpenGL programming, a lot of DirectX programming, but I specialize on C++, and use python only for certain algorithmic tests, tools and scripts. | 1 | 3,573 | 0 | 9 | 2010-06-03T00:28:00.000 | python,graphics,pyopengl | Is PyOpenGL a good place to start learning opengl programming? | 0 | 2 | 2 | 2,963,034 | 1 |
0 | 0 | I'm making a toolbar using wxpython and I want to put the Quit button on the right side of it, I don't want to put them sequencially.
Is it possible to define this position?
Thanks in advance! | true | 2,964,108 | 1.2 | 0 | 0 | 0 | If you add the quit button last, it will be on the right side. | 0 | 292 | 0 | 0 | 2010-06-03T07:47:00.000 | python,button,wxpython,toolbar,position | Is it possible to put a toolbar button on the right side of it using wxpython? | 0 | 1 | 1 | 3,172,009 | 1 |
0 | 0 | I am streaming some data down from a webcam. When I get all of the bytes for a full image (in a string called byteString) I want to display the image using OpenCV. Done fast enough, this will "stream" video from the webcam to an OpenCV window.
Here's what I've done to set up the window:
cvNamedWindow('name of window', CV_WINDOW_AUTOSIZE)
And here's what I do when the byte string is complete:
img = cvCreateImage(IMG_SIZE,PIXEL_DEPTH,CHANNELS)
buf = ctypes.create_string_buffer(byteString)
img.imageData = ctypes.cast(buf, ctypes.POINTER(ctypes.c_byte))
cvShowImage('name of window', img)
cvWaitKey(0)
For some reason this is producing an error:
File "C:\Python26\lib\site-packages\ctypes_opencv\highgui_win32.py", line 226, in execute
return func(*args, **kwargs)
WindowsError: exception: access violation reading 0x015399E8
Does anybody know how to do what I'm trying to do / how to fix this crazy violation error? | false | 2,970,207 | 0.197375 | 0 | 0 | 2 | I actually solved this problem and forgot to post the solution. Here's how I did it, though it may not be entirely robust:
I analyzed the headers coming from the MJPEG of the network camera I was doing this to, then I just read from the stream 1 byte at a time, and, when I detected that the header of the next image was also in the bytestring, I cut the last 42 bytes off (since that's the length of the header).
Then I had the bytes of the JPEG, so I simply created a new Cv Image by using the open(...) method and passing it the byte string wrapped in a StringIO class. | 0 | 1,712 | 0 | 3 | 2010-06-03T22:20:00.000 | python,string,image,opencv,byte | from string of bytes to OpenCV's IplImage in Python? | 0 | 1 | 2 | 2,980,849 | 1 |
0 | 0 | Is NetBeans recommended for developing a GUI for a Python app?
Does it have a form/screen builder for Python apps, like Dabo? | false | 2,971,094 | 0.099668 | 0 | 0 | 2 | I haven't seen a built-in GUI builder for CPython. You could use Jython + Matisse (the built-in Netbeans Java-based GUI builder). | 0 | 11,421 | 0 | 5 | 2010-06-04T02:15:00.000 | python,netbeans | Using NetBeans for Python GUI development | 0 | 1 | 4 | 2,971,227 | 1 |
0 | 0 | I have downloaded the zip archive (my only option) and installed it as suggested by unzipping into the dropin folder. When I try to start a project the problem occurs:
"Plug-in org.python.pydev was unable to load class org.python.pydev.ui.wizard.project.PythonProjectWizard"
I've googled and the only suggestion is to re-download and re-install as it might be a corrupted install. Done that, no good. Any more suggestions? Seems PyDev have a lot of troubles getting the zip alternative to work... (judging by other similar posts)
This is regardless of Eclipse version.
I run under WinXP. | true | 2,972,696 | 1.2 | 0 | 0 | 0 | I had no luck with this. Eventually I had to download it through Eclipse download manager and it worked. I guess they have some issues with the automatic plugin functionality. | 1 | 3,435 | 0 | 2 | 2010-06-04T08:58:00.000 | python,eclipse,eclipse-plugin,pydev | PyDev problem staring project | 0 | 1 | 2 | 3,211,758 | 1 |
0 | 0 | I have a Logitech G15 keyboard. It has a screen. Can i program this? I googled it but the one site i found didn't work.. It seems like it is possible, but i cannot grasp how.
Thanks!
This site is truly great. | false | 2,976,446 | 1 | 0 | 0 | 6 | I believe the G15 comes with an SDK. You could use that along with the ctypes module to call into the supplied DLLs. Otherwise, I imagine you'd have to use something like Swig or Boost.Python to make a Python module for the G15 from the SDK. | 0 | 977 | 0 | 3 | 2010-06-04T17:36:00.000 | python,logitech,g15 | Is Python programming for Logitech G15 possible? | 0 | 1 | 2 | 2,976,466 | 1 |
0 | 0 | By just adding a datagridview in IronPython Studio it triggers a
"DataGridView' object has no attribute 'BeginInit'". Is there a fix for this?
The errors are gone if the lines self._DataGridView1.BeginInit() and self._DataGridView1.EndInit() are deleted, but that's not what it should be done to fix that | true | 2,976,803 | 1.2 | 0 | 0 | 2 | There's no fix for this and there's likely not to be one because IronPython Studio isn't supported anymore. DataGridView.BeginInit is implemented explicitly and IronPython Studio is based upon IronPython 1.1. You might be able to work around with it by changing that to "ISupportInitialize.BeginInit(self._DataGridView1)" after importing ISupportInitialize but I doubt it'll survive round tripping through the designer.
If you wanted to fix this yourself the source for IronPython Studio is available and you could try modifying the winforms designer code to notice the explicit interface implementation call and emit this code instead. That's likely just fixing IronPython's CodeDom generator.
But really I'd advise you to move to IronPython Tools and WPF. Generating code for the WinForms designer doesn't really work that well with IronPython and WPF is much more suitable. An alternate plan would be to generate the WinForm w/ the designer in C# and subclass it from Python. | 0 | 773 | 0 | 1 | 2010-06-04T18:37:00.000 | .net,winforms,ironpython,ironpython-studio | Adding a DataGridView in IronPython Studio Winforms gets a "'DataGridView' object has no attribute 'BeginInit'" | 0 | 1 | 1 | 2,978,656 | 1 |
0 | 0 | I have a dense set of points in the plane. I want them colored so that points that are close to each other have the same color, and a different color if they're far away. For simplicity assume that there are, say, 5 different colors to choose from. Turns out I've not the slightest idea how to do that ..
I'm using Tkinter with Python, by the way | false | 2,979,697 | 0 | 0 | 0 | 0 | I'd start with identifying the concentrations of the spots in the plane. Find the centers of those agglomerations and assign them each unique color. Then for other spots you could simply calculate the color using the linear principle. For example, if one center is red and the other is yellow, a point somewhere in the middle would become orange.
I'd probably use some exponential function instead of a linear principle. This will keep the point groups more or less of the same color only giving a noticeable color change to far away points, or, to be more exact, to far away and somewhere in between points. | 0 | 270 | 0 | 4 | 2010-06-05T08:31:00.000 | python,geometry,tkinter | Coloring close points | 0 | 2 | 4 | 2,979,705 | 1 |
0 | 0 | I have a dense set of points in the plane. I want them colored so that points that are close to each other have the same color, and a different color if they're far away. For simplicity assume that there are, say, 5 different colors to choose from. Turns out I've not the slightest idea how to do that ..
I'm using Tkinter with Python, by the way | false | 2,979,697 | 0 | 0 | 0 | 0 | One approach is to go through your points and partition them into sets with a "center". Since you have 5 colours, you'll have 5 sets. You compare the distance of the new point from each of the centers and then put it in the same group as the closest one.
Each set corresponds to a different colour so you can just plot it after this partitioning is done. | 0 | 270 | 0 | 4 | 2010-06-05T08:31:00.000 | python,geometry,tkinter | Coloring close points | 0 | 2 | 4 | 2,979,707 | 1 |
0 | 0 | I'm attempting to write a Python wrapper for poker-eval, a c static library. All the documentation I can find on ctypes indicates that it works on shared/dynamic libraries. Is there a ctypes for static libraries?
I know about cython, but should I use that or recompile the poker-eval into a dynamic library so that I can use ctypes?
Thanks,
Mike | false | 2,983,649 | 0.099668 | 0 | 0 | 1 | I can't say for sure there are no modules out there, but the advantages of dynamic libraries (uses less space, can update without recompiling dependent programs) are such that you're probably better off doing just that. | 1 | 12,127 | 0 | 16 | 2010-06-06T09:03:00.000 | python,static-libraries,ctypes | ctypes for static libraries? | 0 | 1 | 2 | 2,983,728 | 1 |
0 | 0 | The substance of an app is more important to me than its apperance, yet GUI always seems to dominate a disproportionate percentage of programmer time, development and target resource requirements/constraints.
Ideally I'd like an application architecture that will permit me to develop an app
using a lightweight reference GUI/kit and focus on non gui aspects to produce
a quality app which is GUI enabled/friendly.
I would want APP and the GUI to be sufficiently decoupled to maximize the ease
for you GUI experts to plug the app into to some target GUI design/framework/context.
e.g. targets such as: termcap GUI, web app GUI framework, desktop GUI, thin client GUI.
In short: How do I mostly ignore the GUI, but avoid painting you into a corner when I don't even know who you are yet? | false | 2,991,910 | 0.291313 | 0 | 0 | 3 | Write a core library that handles the functionality and provides hooks for progress notification. Then write the interfaces as separate applications or libraries that use the core library. | 0 | 141 | 0 | 2 | 2010-06-07T17:58:00.000 | python,user-interface,portability | How to ignore GUI as much as possible without rendering APP less GUI developer friendly | 0 | 1 | 2 | 2,991,933 | 1 |
0 | 0 | I installed VS2010 and IronPython tools. When I start a VB.NET WPFProject everything works fine. But when I start a WPF IronPython project, it creates a button by default which fills all the window, and when you try to add an event to that control or another control dragged from the toolbox, you just cant do it. You double click on them, but the event is never added to the sourcecode. Anyone had this problem? | true | 2,996,854 | 1.2 | 0 | 0 | 3 | Currently we don't have support for double clicking and adding an event handler. For the time being you'll need to wire it up by hand. We are going to spend some time on improving the designer experience so that this should eventually work. | 0 | 355 | 0 | 1 | 2010-06-08T11:29:00.000 | .net,wpf,visual-studio-2010,ironpython | Cant add events for controls in WPF IronPython VS2010 | 0 | 1 | 1 | 3,000,618 | 1 |
0 | 0 | How can I make a simple clipboard monitor in Python using the PyGTK GUI?
I found gtk.clipboard class and but I couldn't find any solution to get the "signals" to trigger the event when the clipboard content has changed.
Any ideas? | true | 3,005,522 | 1.2 | 0 | 0 | 4 | Without a proper notification API, such as WM_DrawClipboard messages, you would probably have to resort to a polling loop. And then you will cause major conflicts with other apps that are trying to use this shared resource.
Do not resort to a polling loop. | 0 | 1,505 | 0 | 6 | 2010-06-09T11:54:00.000 | python,clipboard,pygtk,monitor | PyGTK: how to make a clipboard monitor? | 0 | 1 | 1 | 3,010,018 | 1 |
1 | 0 | I want get the details of the wave such as its frames into a array of integers.
Using fname.getframes we can ge the properties of the frame and save in list or anything for writing into another wav or anything,but fname.getframes gives information not in integers some thing like a "/xt/x4/0w' etc..
But i want them in integer so that would be helpful for manupation and smoothening join of 2 wav files | false | 3,021,046 | 0 | 0 | 0 | 0 | NumPy can load the data into arrays for easy manipulation. Or SciPy. I forget which. | 0 | 660 | 0 | 1 | 2010-06-11T07:45:00.000 | python,wav | wav file manupalation | 0 | 1 | 3 | 3,021,073 | 1 |
0 | 0 | I have a list of Project objects, that I display in a GtkTreeView. I am trying to open a dialog with a Project's details when the user double-clicks on the item's row in the TreeView.
Right now I get the selected value from the TreeView (which is the name of the Project) via get_selection(), and search for that Project by name in my own list to corelate the selection with my own model.
However, this doesn't feel quite right (plus, it assumes that a Project's name is unique), and I was wondering if there is a more elegant way of doing it. | true | 3,032,905 | 1.2 | 0 | 0 | 1 | What I ended up doing was extending gtk.ListStore and use my custom list. I also hijacked the append() method so that not only it will append a [str, str, etc] into the ListStore, but also the actual model inside a custom list property of the class that extends ListStore.
Then, when the user double clicks the row, I fetch the requested model by the row's index in the ListStore, which corresponds to the model's index in the custom list. | 0 | 296 | 0 | 1 | 2010-06-13T16:09:00.000 | python,pygtk,gtktreeview | How to correlate gtk.ListStore items with my own models | 0 | 1 | 2 | 3,056,761 | 1 |
0 | 0 | When you write an application using Qt, can it just be run right away in different operating systems? And (correct me if I'm wrong) you don't need to have Qt already installed in all of the different platforms where you want to execute your application?
How exactly does this work? Does Qt compile to the desired platform, or does it bundle some "dlls" (libs), or how does it do it? Is it different from programming a Java application, that runs cross-platform.
If you use Python to write a Qt application with Python bindings, does your end user need to have Python installed? | false | 3,045,745 | 1 | 0 | 0 | 15 | Qt (ideally) provides source compatibility, not binary compatibility. You still have to compile the application separately for each platform, and use the appropriate dynamic Qt libraries (which also need to be compiled separately, and have some platform-specific code).
For your final question, the user would need Python, the Qt libraries, and the binding library (e.g. pyqt), but there are various ways to bundle these. | 1 | 3,747 | 0 | 13 | 2010-06-15T13:49:00.000 | python,qt | How does Qt work (exactly)? | 0 | 1 | 3 | 3,045,754 | 1 |
0 | 0 | How do I force a GTK window object to stay the same size, even when a table inside of it tries to expand?
I've tried using gtk.SHRINK when attaching children to the table, but the TextViews within the table still keep expanding to way beyond an acceptable width and expanding the window along with it. | false | 3,047,582 | 0 | 0 | 0 | 0 | Text views won't expand if you pack them into a gtk.ScrolledWindow. This is not what you directly asked, but I believe should solve your problem in a better way. | 0 | 6,353 | 0 | 1 | 2010-06-15T17:41:00.000 | python,pygtk | How to force GTK window to stay at a certain width, even when widgets try to expand? | 0 | 1 | 2 | 3,048,270 | 1 |
0 | 0 | I would like to add 1,000,000+ entries to the root node of a TreeListCtrl. Therefore I would like to make it "virtual", i.e. work just like a virtual ListCtrl so that it's still fast and I can easily scroll around due to the currently-displayed items being loaded on-demand. But I can't use a virtual ListCtrl because I also want to be able to expand any of the 1,000,000 items to display its children (the items will always have less than 50 children). Can this be done efficiently with a TreeListCtrl? Or with a different class? From my own experiments with treemixin.VirtualTree and wx.gizmos.TreeListCtrl, overloading the OnGetItemText method does not work the same way as it does with a plain virtual ListCtrl. It doesn't get called on-demand as the user is scrolling around, meaning all 1,000,000 items have to be added to the TreeListCtrl in advance. | false | 3,074,175 | 0 | 0 | 0 | 0 | One thing you might do is leave the sub-nodes empty, and catch the expand-node event. Then you check to see if the node's sub-nodes are populated. If they aren't, you add them before expanding the node. If they are populated, you simply ignore the event. | 0 | 762 | 0 | 0 | 2010-06-19T03:15:00.000 | python,wxpython,virtual,listctrl,treecontrol | wxPython: VirtualTreeListCtrl with millions of items | 0 | 3 | 3 | 3,074,866 | 1 |
0 | 0 | I would like to add 1,000,000+ entries to the root node of a TreeListCtrl. Therefore I would like to make it "virtual", i.e. work just like a virtual ListCtrl so that it's still fast and I can easily scroll around due to the currently-displayed items being loaded on-demand. But I can't use a virtual ListCtrl because I also want to be able to expand any of the 1,000,000 items to display its children (the items will always have less than 50 children). Can this be done efficiently with a TreeListCtrl? Or with a different class? From my own experiments with treemixin.VirtualTree and wx.gizmos.TreeListCtrl, overloading the OnGetItemText method does not work the same way as it does with a plain virtual ListCtrl. It doesn't get called on-demand as the user is scrolling around, meaning all 1,000,000 items have to be added to the TreeListCtrl in advance. | false | 3,074,175 | 0 | 0 | 0 | 0 | You're right that the treemixin doesn't make the TreeListCtrl really virtual. I thought about that when I was developing treemixin, but the one thing I didn't know how to solve was how to know which lines to draw to the left of items when the user is looking at items deep down the tree, e.g. 10000 to 10030. If you know of a solution for that I'll gladly adapt treemixin.
Frank
Author treemixin | 0 | 762 | 0 | 0 | 2010-06-19T03:15:00.000 | python,wxpython,virtual,listctrl,treecontrol | wxPython: VirtualTreeListCtrl with millions of items | 0 | 3 | 3 | 3,074,875 | 1 |
0 | 0 | I would like to add 1,000,000+ entries to the root node of a TreeListCtrl. Therefore I would like to make it "virtual", i.e. work just like a virtual ListCtrl so that it's still fast and I can easily scroll around due to the currently-displayed items being loaded on-demand. But I can't use a virtual ListCtrl because I also want to be able to expand any of the 1,000,000 items to display its children (the items will always have less than 50 children). Can this be done efficiently with a TreeListCtrl? Or with a different class? From my own experiments with treemixin.VirtualTree and wx.gizmos.TreeListCtrl, overloading the OnGetItemText method does not work the same way as it does with a plain virtual ListCtrl. It doesn't get called on-demand as the user is scrolling around, meaning all 1,000,000 items have to be added to the TreeListCtrl in advance. | false | 3,074,175 | 0 | 0 | 0 | 0 | I think what I'll do is use a virtual ListCtrl along with a skip-list for the data model. Initially, the data model will contain the 1 million top-layer nodes. When a node is expanded, I can insert its children into the skip-list in log time (much better than the linear time for an array). I will indent the names of the children in the ListCtrl so that you can visually tell who their parent is. I think the log search time for the skip-list (as opposed to instant random-access time for an array) will be fast enough to handle the user's scrolling. If someone has a better suggestion, please let me know. I will provide an update in the future as to whether my idea worked or not. | 0 | 762 | 0 | 0 | 2010-06-19T03:15:00.000 | python,wxpython,virtual,listctrl,treecontrol | wxPython: VirtualTreeListCtrl with millions of items | 0 | 3 | 3 | 3,087,197 | 1 |
0 | 0 | I have one wx.emptybitmap (1) and one wx.bitmap (2). I want to merge(join) them..
I want to create a single wx.bitmap that consists on the wx.emptybitmap (1) on the top and wx.bitmap (2) on the bottom.
How can I do that?
Thanks in advance! :D | false | 3,079,409 | 0 | 0 | 0 | 0 | You could always use PIL, it has a function to do this. Save the image in memory and convert it into an wx.Bitmap. | 0 | 1,043 | 0 | 1 | 2010-06-20T13:36:00.000 | python,image,wxpython,image-manipulation | How to merge (join) two wx.bitmap using wxpython? | 0 | 1 | 2 | 11,616,749 | 1 |
0 | 0 | When I type from Tkinter import ttk it says that there is no module named ttk, and also on many websites online the t in tkinter is always lowercase, but when I type tkinter in Python it throws an error. Why is that? | false | 3,080,918 | 1 | 0 | 0 | 12 | Tkinter in python 2.6 is capitalized, in python 3 it is lowercase, tkinter | 1 | 54,493 | 0 | 18 | 2010-06-20T20:58:00.000 | python,python-3.x,tkinter | Why can't I use ttk in Python? | 0 | 1 | 4 | 3,081,089 | 1 |
0 | 0 | Am trying to provide a response from a Managers perspective to the question: What overall performance penalty will we incur if we write the application in IronPython instead of C#?
This question is directed at those who might have already undertaken some testing, benchmarking or have completed a migration from C# to IronPython, in order to quantify the penalty. | false | 3,081,661 | -0.099668 | 1 | 0 | -2 | Based on my understanding both languages will be compiled into MSIL so theoretically the performance of the application should be identical or very close, but there is a lot more to it, the human factor.
I can assure you that a program I write in C# could be a lot faster that the same program in iron-python not because C# is faster but because I'm more familiar with C# and I know what choices to make, so if your team is more familiar with C# your application has a better chance at performance if it is written in C# or the other way around.
This is just a personal theory so take it with a grain of salt. | 1 | 8,794 | 0 | 7 | 2010-06-21T01:27:00.000 | ironpython | Speed of code execution: IronPython vs C#? | 0 | 1 | 4 | 3,082,237 | 1 |
0 | 0 | If it doesn't use ironpython, how C# use cpython program(py file)?
Because there are some bugs that ironpython load cpython code. | true | 3,083,167 | 1.2 | 1 | 0 | 0 | If you need strict CPython behavior and do not want to change Python program I am afraid that in this case you should spawn separate CPython process and interact with it via some RPC protocol (there are plenty to choose from) via pipe or network connection to localhost.
As alternative to "serialized" RPC you might use system's facilities e.g. COM if you're on Windows or D-Bus on Linux - but this would make code platform dependent and not necessarily simpler. | 1 | 189 | 0 | 0 | 2010-06-21T08:47:00.000 | c#,python,cpython | How C# use python program? | 0 | 1 | 1 | 3,083,261 | 1 |
0 | 0 | I have a dialog which contains a pygtk.treeview for listing tasks by priority. Each row has the background colour set based on that priority, so for example the highest priority has a light red background.
The row selection color is not so easy to change. I can set it using treeview.modify_base(gtk.STATE_SELECTED, "#C4C4C4"), but no colours work well with the colours used to enhance the concept of priority.
I had the idea to change the selection colour to be a slightly darker version of the colour used as the normal row background, so in the example above, that would be a darker red. I tried calling the function above in response to the treeselection's changed signal, and it works, but with heavy flickering.
Another idea was to change the selection to transparent and put a border around it instead, but as far as I can tell, this isn't possible.
How can I change the selection colour in the way described above without the flickering?
Can I change show the selection by having only a border around the row?
Note: I'm aware that this violates the theme selected by the user. I feel I have a good reason for it. Having the priority indicated by colour makes it instantly recognisable. The selection colour hides this. If you have alternative suggestions, I am open to them, but it needs to retain the ease at which a user can identify the priority. | false | 3,099,244 | 0 | 0 | 0 | 0 | Calling both ModifyBase and ModifyText worked for me. Calling just ModifyBase changes the text color to White
Example in GTK C#:
treeViewList.ModifyBase(StateType.Selected, treeViewList.Style.Base(StateType.Normal));
treeViewList.ModifyText(StateType.Selected, treeViewList.Style.Text(StateType.Normal)); | 0 | 3,920 | 0 | 9 | 2010-06-23T05:58:00.000 | python,user-interface,gtk,pygtk,gtktreeview | Changing the selected item colour in a GtkTreeview using python | 0 | 2 | 5 | 60,073,336 | 1 |
0 | 0 | I have a dialog which contains a pygtk.treeview for listing tasks by priority. Each row has the background colour set based on that priority, so for example the highest priority has a light red background.
The row selection color is not so easy to change. I can set it using treeview.modify_base(gtk.STATE_SELECTED, "#C4C4C4"), but no colours work well with the colours used to enhance the concept of priority.
I had the idea to change the selection colour to be a slightly darker version of the colour used as the normal row background, so in the example above, that would be a darker red. I tried calling the function above in response to the treeselection's changed signal, and it works, but with heavy flickering.
Another idea was to change the selection to transparent and put a border around it instead, but as far as I can tell, this isn't possible.
How can I change the selection colour in the way described above without the flickering?
Can I change show the selection by having only a border around the row?
Note: I'm aware that this violates the theme selected by the user. I feel I have a good reason for it. Having the priority indicated by colour makes it instantly recognisable. The selection colour hides this. If you have alternative suggestions, I am open to them, but it needs to retain the ease at which a user can identify the priority. | false | 3,099,244 | 0 | 0 | 0 | 0 | Not sure what you mean by flickering. A border would require subclassing TreeView.
I'd make the STATE_SELECTED color identical to STATE_NORMAL to disable the built-in highlighting. Then set a data_func on each column and change some color on the cell renderer depending on whether it's in the selection or not.
You're probably already doing this for your priority, so just multiply the color with something to highlight a row. | 0 | 3,920 | 0 | 9 | 2010-06-23T05:58:00.000 | python,user-interface,gtk,pygtk,gtktreeview | Changing the selected item colour in a GtkTreeview using python | 0 | 2 | 5 | 3,099,780 | 1 |
0 | 0 | I've been annoyed lately by the fact that PyDev doesn't information about classes and function when it code completes wxPython code.
Can anybody tell me FOSS IDE's or extensions that offer code information (function params, returns etc.) when it code completes for C/C++ and Python.
I am a fan of CodeLite, Eclipse CDT and CodeBlocks in that order for C/C++ (excepting non-FOSS)
and PyScripter, PyDev for Python in that order. | false | 3,101,160 | 0 | 0 | 0 | 0 | I use notepad++ and am vary happy with it. | 0 | 144 | 0 | 5 | 2010-06-23T11:30:00.000 | c++,python,c,ide,code-completion | ide code information | 0 | 1 | 2 | 3,102,007 | 1 |
0 | 0 | I've been working with a few RAD gui builders lately. I absolutely despise CSS ( camel is a horse designed by committee etc.) What algorithms are used by packing managers(java/tk). Most GUI toolkits I've used have some alternative to absolute positioning, sorry for the ambiguity but how do you start thinking about implementing a packing manger in language X.
Thanks for the replies, to clarify - I want to create a generic text file that defines a 'form' this form file can then be used to generated a native(ish) GUI form (eg tk) and also an HTML form.
What I'm looking for is some pointers on how a grid based packing manager is implemented so I can formulate my generic text file based on some form of established logic.
If this doesn't make sense to you then you understand me:). Some notes
1. XML lives in the same stable as the zebra and the camel but not the horse.
2. Think lightweight markup languages (Markdown/ReStructuredText) but for simple forms.
3. This has probably already been implemented, do you know where?
4. Yes, I have Googled it (many,many times),answer was not between G1 and o2
Thks | false | 3,122,291 | 0.53705 | 0 | 0 | 3 | Tk has three methods. One is absolute positioning, the other two are called "grid" and "pack".
grid is just what it sounds like: you lay out your widgets in a grid. There are options for spanning rows and columns, expanding (or not) to fill a cell, designating rows or columns which can grow, etc. You can accomplish probably 90% of all layout issues with the grid geometry manager.
The other manager is "pack" and it works by requesting that widgets be placed on one side or another (top, bottom, left, right). It is remarkably powerful, and with the use of nested containers (called frames in tk) you can accomplish pretty much any layout as well. Pack is particularly handy when you have things stacked in a single direction, such as horizontally for a toolbar, vertically for a main app (toolbar, main area, statusbar).
Both grid and pack are remarkably powerful and simple to use, and between them can solve any layout problem you have. It makes me wonder why Java and wxPython have so many and such complicated geometry managers when its possible to get by with no more than three. | 0 | 306 | 0 | 0 | 2010-06-26T00:55:00.000 | python,grid,tcl,rad | GUI layout -how? | 0 | 1 | 1 | 3,122,400 | 1 |
0 | 0 | I'm planning some Symbian related development on S60 3.1 platform. It seems like generally available language options are Python and C++. However Nokia's official forum seems very much tilted towards C++.
I want to know what are the advantages and disadvantages of using Python for S60 over Symbian C++? And is it even possible to do Python programming for S60 3.1 platform? | false | 3,123,340 | 0.033321 | 1 | 0 | 1 | C++ is very, very fast, and the Qt library is for C++. If you're programming on a mobile phone, Python will be very slow and you'll have to spend ages writing bindings for it. | 0 | 1,021 | 0 | 1 | 2010-06-26T09:15:00.000 | c++,python,symbian,pys60 | PyS60 vs Symbian C++ | 0 | 3 | 6 | 3,123,427 | 1 |
0 | 0 | I'm planning some Symbian related development on S60 3.1 platform. It seems like generally available language options are Python and C++. However Nokia's official forum seems very much tilted towards C++.
I want to know what are the advantages and disadvantages of using Python for S60 over Symbian C++? And is it even possible to do Python programming for S60 3.1 platform? | false | 3,123,340 | 0.033321 | 1 | 0 | 1 | I answer this as a user.
PyS60 is slow and not so much app and sample to start with.
C++ is good, native, fast, but if you mind deevelop app for most device (current N-series), you will not want to go with Qt, I have a N78 and tested Qt in N82 too, it's slow (more than Python, sadly but true) | 0 | 1,021 | 0 | 1 | 2010-06-26T09:15:00.000 | c++,python,symbian,pys60 | PyS60 vs Symbian C++ | 0 | 3 | 6 | 3,124,371 | 1 |
0 | 0 | I'm planning some Symbian related development on S60 3.1 platform. It seems like generally available language options are Python and C++. However Nokia's official forum seems very much tilted towards C++.
I want to know what are the advantages and disadvantages of using Python for S60 over Symbian C++? And is it even possible to do Python programming for S60 3.1 platform? | false | 3,123,340 | 0 | 1 | 0 | 0 | What is the purpose of your programming? Are you planning distribute your app through Ovi Store? If so, you should use a tool that could be tested and signed by Symbian Signed.
What does it mean? As far as I know, they don't provide such functionality for Python. So you have to choose native Symbian C++ or Qt.
By the way, Qt signing procedure is not quite clear for now. It seems Ovi Store and Symbian Signed are only allow Qt apps for a certain devices (Nokia X6, Nokia N97 mini, maybe some other). I suppose it is a subject for a change, and quite fast change, but you should consider this too. | 0 | 1,021 | 0 | 1 | 2010-06-26T09:15:00.000 | c++,python,symbian,pys60 | PyS60 vs Symbian C++ | 0 | 3 | 6 | 3,131,900 | 1 |
0 | 0 | In Tkinter I'm trying to make it so when a command is run a widget is automatically selected, so that a one may bind events to the newly selected widget.
Basically I want it so when I press a button a text widget appears. When it appears normally one would have to click the text widget to facilitate the running of events bound to the text widget. I want that behavior to automatically happen when the user clicks the button. So that one does not have to click the button and then the text widget, but simply the button.
I'd also like it so if one started typing after the button was pressed it would automatically start filling the text widget. Again to cut out having to click on the text widget.
What bit of code does the above? | true | 3,125,707 | 1.2 | 0 | 0 | 0 | The terminology which describes what you want is "focus" -- you want to set the keyboard focus to your text widget. To do that you need to use the focus_set() and/or focus_force() methods on the text widget. | 0 | 45 | 0 | 0 | 2010-06-26T22:25:00.000 | python,binding,tkinter | Selecting Widgets | 0 | 1 | 1 | 3,126,035 | 1 |
0 | 0 | I am having a problem with widget Gtk.Table - I would like to know, if there is a way how to get a current size of the table (number of rows and columns).
Thank you, very much for help, Tomas | false | 3,126,802 | 0 | 0 | 0 | 0 | In most recent versions of PyGTK you can get/set those values via table.props.n_columns and table.props.n_rows, which is synonymous with the get_property() (mentioned in the other answers) and set_property() methods. | 0 | 881 | 0 | 0 | 2010-06-27T08:17:00.000 | python,gtk,pygtk | Getting size of Gtk.Table in python | 0 | 1 | 3 | 3,128,879 | 1 |
0 | 0 | We all knows that C# is a static language while Python is a dynamic language. But I want to know what are the features that Python has and c# does not. Also, is it advisable/beneficial to use IronPython with c# in the same application?
Also what points I should focus to learn before I try to convince my boss to use IronPython? | false | 3,131,703 | 1 | 1 | 0 | 7 | One of IronPython's key advantages is in its function as an extensibility layer to application frameworks written in a .NET language. It is relatively simple to integrate an IronPython interpreter into an existing .NET application framework. Once in place, downstream developers can use scripts written in IronPython that interact with .NET objects in the framework, thereby extending the functionality in the framework's interface, without having to change any of the framework's code base.
IronPython makes extensive use of reflection. When passed in a reference to a .NET object, it will automatically import the types and methods available to that object. This results in a highly intuitive experience when working with .NET objects from within an IronPython script.
Source - Wikipedia | 1 | 995 | 0 | 2 | 2010-06-28T10:46:00.000 | c#,architecture,ironpython | Why should C# developer learn IronPython? | 0 | 2 | 2 | 3,131,716 | 1 |
0 | 0 | We all knows that C# is a static language while Python is a dynamic language. But I want to know what are the features that Python has and c# does not. Also, is it advisable/beneficial to use IronPython with c# in the same application?
Also what points I should focus to learn before I try to convince my boss to use IronPython? | true | 3,131,703 | 1.2 | 1 | 0 | 7 | In other words, what points I can give to my boss to convince him to use IronPython?
Don't. If you don't know why you should use a new tool and for what, don't try to convice anybody to use it. At work, you should try to solve problems with the best tools for the task, not throw the fanciest tools avaiable at your problems just because they're fancy.
Learn IronPython, maybe make a small side project in it, find out what the strenghts are. Then if you think these strengths are useful for the project you're working on (e.g. for "glue code", plugins, macros etc.), convice your boss to use them. | 1 | 995 | 0 | 2 | 2010-06-28T10:46:00.000 | c#,architecture,ironpython | Why should C# developer learn IronPython? | 0 | 2 | 2 | 3,131,741 | 1 |
0 | 0 | I have a wxPython application which allows the users to select items from menus that then change what is visible on the screen. This often requires a recalculation of the layout of panels. I'd like to be able to call the layout of all the children of a panel (and the children of those children) in reverse order. That is, the items with no children have their Layout() function called first, then their parents, and so on.
Otherwise I have to keep all kinds of knowledge about the parents of panels in the codes. (i.e. how many parents will be affected by a change in this-or-that panel). | true | 3,136,997 | 1.2 | 0 | 0 | 0 | More in response to your comment to Jon Cage's answer, than to your
original question (which was perfectly answered by Jon):
The user might find it irritating, if the position of every element in
your dialog changes, when he makes a choice. Maybe it'll look better,
if only the "variable part" is updated. To achieve this, you could
make a panel for each set of additional controls. The minimum size of
each panel should be the minimum size of the largest of these
panels. Depending on the user's choice you can hide or show the
desired panel.
Alternatively, wxChoicebook might be what you need? | 0 | 248 | 0 | 1 | 2010-06-28T23:58:00.000 | python,model-view-controller,wxpython,dry,wxwidgets | How to layout all children of a wxPanel? | 0 | 1 | 2 | 3,137,378 | 1 |
0 | 0 | Trying to dive into Qt big time but haven't done a large project with it yet. Currently using Python, but I've been thinking -- which is really the better language to use in terms of programmer productivity?
In most comparisons between the languages, Python is the obvious answer, because you don't have to mess with memory management and all that.
However, with Qt I'm not so sure. It provides enough added features to C++ that (from what I can tell) a line of Python code is roughly equal to a line of C++ code most of the time (excluding some additional things like class definitions and structure components). Qt does nearly all the memory management for you as long as you stick with its classes, and provides equivalents to the nice containers you would find in Python.
I've always preferred statically typed languages, but have gotten on the Python bandwagon for various reasons. If programmer productivity is similar with C++, however, I may jump back that way for its other benefits -- more efficient code and fewer dependencies for users to install.
Thoughts? | false | 3,139,414 | 1 | 0 | 0 | 7 | With Python you don't have to build your project. That's enough of a time saver I guess. And Pyqt bindings are awesome. I'm definitely more efficient with pyqt than with qt/C++. | 0 | 16,818 | 0 | 47 | 2010-06-29T09:32:00.000 | c++,python,qt,pyqt | Qt programming: More productive in Python or C++? | 0 | 5 | 5 | 3,139,453 | 1 |
0 | 0 | Trying to dive into Qt big time but haven't done a large project with it yet. Currently using Python, but I've been thinking -- which is really the better language to use in terms of programmer productivity?
In most comparisons between the languages, Python is the obvious answer, because you don't have to mess with memory management and all that.
However, with Qt I'm not so sure. It provides enough added features to C++ that (from what I can tell) a line of Python code is roughly equal to a line of C++ code most of the time (excluding some additional things like class definitions and structure components). Qt does nearly all the memory management for you as long as you stick with its classes, and provides equivalents to the nice containers you would find in Python.
I've always preferred statically typed languages, but have gotten on the Python bandwagon for various reasons. If programmer productivity is similar with C++, however, I may jump back that way for its other benefits -- more efficient code and fewer dependencies for users to install.
Thoughts? | false | 3,139,414 | 0.119427 | 0 | 0 | 3 | Whether you use python or C++ depends more on the application you are building and not so much on Qt. If you are building an application which is resource heavy and needs lots of resources like CPU and memory, C++ would be a better bet. On the other hand, if you application is more UI driven, python provides lot of other benefits in terms of rapid development and rich libraries. | 0 | 16,818 | 0 | 47 | 2010-06-29T09:32:00.000 | c++,python,qt,pyqt | Qt programming: More productive in Python or C++? | 0 | 5 | 5 | 3,139,458 | 1 |
0 | 0 | Trying to dive into Qt big time but haven't done a large project with it yet. Currently using Python, but I've been thinking -- which is really the better language to use in terms of programmer productivity?
In most comparisons between the languages, Python is the obvious answer, because you don't have to mess with memory management and all that.
However, with Qt I'm not so sure. It provides enough added features to C++ that (from what I can tell) a line of Python code is roughly equal to a line of C++ code most of the time (excluding some additional things like class definitions and structure components). Qt does nearly all the memory management for you as long as you stick with its classes, and provides equivalents to the nice containers you would find in Python.
I've always preferred statically typed languages, but have gotten on the Python bandwagon for various reasons. If programmer productivity is similar with C++, however, I may jump back that way for its other benefits -- more efficient code and fewer dependencies for users to install.
Thoughts? | false | 3,139,414 | 1 | 0 | 0 | 33 | If one or the other, I'd actually suggest Python in spite of being a C++ enthusiast. With Python code you don't have to bother with the MOC, portability, build times, etc. Just compare the work involved in implementing a QT slot in C++ vs. PyQT or PySide, e.g. I find it to be much less of a pain to deal with widgets this way (much greater productivity). You can still invoke C++ code from Python in cases where you need the added performance.
If you do use a combination, consider extending Python rather than embedding it. Python is generally better suited to embed C/C++ code than to be embedded into a C/C++ system. It also tends to make more sense that way as applications are generally composed of far more mundane, non-performance critical code than performance-critical code, so writing your application primarily as a python application with C/C++ functions attached to it fits that kind of system design better. | 0 | 16,818 | 0 | 47 | 2010-06-29T09:32:00.000 | c++,python,qt,pyqt | Qt programming: More productive in Python or C++? | 0 | 5 | 5 | 3,139,451 | 1 |
0 | 0 | Trying to dive into Qt big time but haven't done a large project with it yet. Currently using Python, but I've been thinking -- which is really the better language to use in terms of programmer productivity?
In most comparisons between the languages, Python is the obvious answer, because you don't have to mess with memory management and all that.
However, with Qt I'm not so sure. It provides enough added features to C++ that (from what I can tell) a line of Python code is roughly equal to a line of C++ code most of the time (excluding some additional things like class definitions and structure components). Qt does nearly all the memory management for you as long as you stick with its classes, and provides equivalents to the nice containers you would find in Python.
I've always preferred statically typed languages, but have gotten on the Python bandwagon for various reasons. If programmer productivity is similar with C++, however, I may jump back that way for its other benefits -- more efficient code and fewer dependencies for users to install.
Thoughts? | true | 3,139,414 | 1.2 | 0 | 0 | 31 | My Opinion (having tried out C++ and Python in general and specifically in Qt case): Python always wins in terms of 'programmer productivity' and 'peace of mind'. PyQt represent Qt very well and hence question doesn't remain of "Qt with Python" or "Qt with C++", in general python is more productive unless off-course you need speed or something which isn't available in python.
Best way for you to arrive at the answer would be to write a simple project first in C++ and then same project in python and compare, but that could be biased towards python as after coding the project once you may find it easy in Python, so try another project too and first do it in Python and then in C++. | 0 | 16,818 | 0 | 47 | 2010-06-29T09:32:00.000 | c++,python,qt,pyqt | Qt programming: More productive in Python or C++? | 0 | 5 | 5 | 3,139,545 | 1 |
0 | 0 | Trying to dive into Qt big time but haven't done a large project with it yet. Currently using Python, but I've been thinking -- which is really the better language to use in terms of programmer productivity?
In most comparisons between the languages, Python is the obvious answer, because you don't have to mess with memory management and all that.
However, with Qt I'm not so sure. It provides enough added features to C++ that (from what I can tell) a line of Python code is roughly equal to a line of C++ code most of the time (excluding some additional things like class definitions and structure components). Qt does nearly all the memory management for you as long as you stick with its classes, and provides equivalents to the nice containers you would find in Python.
I've always preferred statically typed languages, but have gotten on the Python bandwagon for various reasons. If programmer productivity is similar with C++, however, I may jump back that way for its other benefits -- more efficient code and fewer dependencies for users to install.
Thoughts? | false | 3,139,414 | 1 | 0 | 0 | 11 | definitely Python.
Yes, people will say that Python is more productive without a reason. Some of the answers mention that you do not have to recompile. I will give you some more details
Python is one layer of abstraction over C++, so you can think and express your designs with less code. Your program might not run as fast, but sure you express faster in code what you want.
The most common case is when you launch your application, load some files, setup the environment and open a dialog. There you notice that a button is not working or where it should be. Now that is the point where most people close the application, bind one slot here, one signal there... and start the application, load the files, setup... with python you just write the code and fire up the dialog again, not the whole application. I do not know about you, but that type of task is what I do most of the time with Qt
Python gives you something that C++ does not have: introspection. You can explore a running program and pull out information about its components on runtime. Qt gives you partially this. You have that MOC layer where meta properties and meta information can be attached to Qt objects. All parts of a Python program can be introspected. Many people debugging Python code, or trying to understand how it works, are addicted to this for a good reason | 0 | 16,818 | 0 | 47 | 2010-06-29T09:32:00.000 | c++,python,qt,pyqt | Qt programming: More productive in Python or C++? | 0 | 5 | 5 | 7,457,626 | 1 |
0 | 0 | I've just started to learn pygame, and it pretty much needs some coordinates and points in the code in order to position the object. Do you know of any tool or application that I could use as a reference so that I could see a visual representation of the points.
Maybe a grid with numbers.
And pygame also includes declaring the color by using numbers.
Do you know of any site or application that I can use as reference to those numbers and corresponding color. Like this one: 230, 170, 0 And what do these numbers mean.
I'm using windows operating system. | false | 3,154,830 | 0.024995 | 0 | 0 | 1 | You don't need a grid to help you, you just need to know the origin point (easy - it is one of the corners). Since it is all interpreted, I say you just hack around displaying stuff on the screen till it clicks in your head.
The other part is easy. It is Red, Blue, Green (each one goes from 0-255, 0 is no-color, 255 is full-color). | 1 | 1,295 | 0 | 1 | 2010-07-01T03:03:00.000 | python,pygame | tools for pygame | 0 | 1 | 8 | 3,154,895 | 1 |
1 | 0 | I'm building a form class in python for producing and validating HTML forms. Each field has an associated widget which defines how the field is rendered.
When the widget is created, it is passed in a (default) value so that it knows what to display the first time it is rendered. After the form is submitted, the widget is asked for a value. I delegate this to the widget rather than just nabbing it from the POST data because a widget may consist of several HTML inputs (think of a month/day/year selector). Only the widget knows how to mash these together into one value.
Problem is, I don't know if I should have the widget always accept a string, and always return a string for consistency, or accept and return a data type consistent with its purpose (i.e., a date selector should probably return a DateTime object).
The philosophy behind my form class is "mix and match". You choose what widget you want, and what validators/formatters/converters you want to run on it. Which I guess lends itself towards "use strings" and let the developer decide on the data type afterwords, but... I can't think of a good but. Do you anticipate any problems with this approach? | true | 3,169,096 | 1.2 | 0 | 0 | 2 | While simply passing strings around seems like a useful idea, I think you're going to discover it doesn't work as well as you might hope.
Think about the date example—instead of passing around a date object, instead you pass around a str of the format "2010-01-01". In order to work with that data, every user of the class needs to know not only that it's a str which represents a date, but what the format of that string is. In other words, you haven't gained anything. Worse, you lose the ability to pass a datetime object into the widget (unless you take extra steps to deal with that case).
The validator or formatter issue isn't as big a deal as you might think; how often are you going to want to validate a string which doesn't represent a date as if it were a date? | 1 | 80 | 0 | 2 | 2010-07-02T21:04:00.000 | python,design-patterns | What data type should my widgets accept/return? | 0 | 2 | 2 | 3,169,254 | 1 |
1 | 0 | I'm building a form class in python for producing and validating HTML forms. Each field has an associated widget which defines how the field is rendered.
When the widget is created, it is passed in a (default) value so that it knows what to display the first time it is rendered. After the form is submitted, the widget is asked for a value. I delegate this to the widget rather than just nabbing it from the POST data because a widget may consist of several HTML inputs (think of a month/day/year selector). Only the widget knows how to mash these together into one value.
Problem is, I don't know if I should have the widget always accept a string, and always return a string for consistency, or accept and return a data type consistent with its purpose (i.e., a date selector should probably return a DateTime object).
The philosophy behind my form class is "mix and match". You choose what widget you want, and what validators/formatters/converters you want to run on it. Which I guess lends itself towards "use strings" and let the developer decide on the data type afterwords, but... I can't think of a good but. Do you anticipate any problems with this approach? | false | 3,169,096 | 0.099668 | 0 | 0 | 1 | This approach is quite generic and serializing to and from strings should always work fine. You could also save the state of a widget to a file or send it over a network for recreating another widget from it.
Some potential issues or aspects to consider:
Localization: how to interpret the string regarding the culture, which format is the canonical format for comparisons.
Performance: some transformations might be time consuming, but I assume for human interaction that will be far fast enough. | 1 | 80 | 0 | 2 | 2010-07-02T21:04:00.000 | python,design-patterns | What data type should my widgets accept/return? | 0 | 2 | 2 | 3,169,184 | 1 |
0 | 0 | I have a function that calculates the number of images that can be displayed on the screen, if there are more images than the ones that can be put on screen, I resize the images till they all can appear.
Then, I want to display them with one vertical box sizer and several horizontal box sizers!
The horizontal number of box sizers are dynamic, it can be only one or more depending on the number of images.
How can I define several box sizers and add them to the vertical box sizer? | true | 3,171,256 | 1.2 | 0 | 0 | 0 | wx.GridSizer is the answer! | 0 | 153 | 0 | 1 | 2010-07-03T10:55:00.000 | python,wxpython,sizer | How to make a dynamic number of horizontal BoxSizers? | 0 | 1 | 2 | 3,174,624 | 1 |
0 | 0 | Suppose you know the three vertices for a spherical triangle.
Then how do you draw the sides on a sphere in 3D?
I need some python code to use in Blender 3d modelisation software.
I already have the sphere done in 3D in Blender.
Thanks & happy blendering.
note 1:
i have the 3 points / vertices (p1,p2,p3 ) on the sphere for a spherical triangle
but i need to trace the edges on the sphere in 3D
so what would be the equations needed to determine all vertices between each points pair of the triangle on the sphere
3 edges from p1 to p2 - p2 to p3 and o3 to p1
i know it has something to do with the Great circle for Geodesic on a sphere
but cannot find the proper equations to do the calculations in spherical coordinates!
Thanks
Great circles
it would have been interesting to see a solution with great circle and see tehsolution in spherical coordinates directly !
but still interesting to do it in the euclidiens space
Thanks
ok i used this idea of line segment between 2 points
but did not do it as indicated before
i used an alternative method - Bezier line interpolation**
i parametrize the line with a bezier line
then subdivided and calculated as shonw ealier the ratio and angle for each of the subdivided bezier point on the chord
and it works very well and very precise
but it would be interesting to see how it is done whit the earlier method
but not certain how to do the iteration loop?
how do you load up the python code here
just past it with Ctrl-V?
Thanks and happy 2.5
i do use the blenders' forum
but no guaranti to get a clear answer all the time!
that's why i tried here - took a chance
i did the first edge seems to work
now got to make a loop to get multi segment for first edge and then do the other edges also
2- other subject
i open here a post on bezier triangle patch
i know it's not a usfull tool
but just to show how it is done
have youeseen a python sript to do theses triangel patch
and i did ask this questin on blender's foum and no answer
also on IRC python and sems to be dead right now
probably guys are too busy finishing the 2.5 Beta vesion which should come out in a week or 2
Hey Thanks a lot for this math discussion
if i have problem be back tomorrow
happy math and 2.5 | false | 3,172,535 | 0 | 0 | 0 | 0 | One cheap and easy method for doing this would be to create the triangle and subdivide the faces down to the level of detail you want, then normalize all the vertices to the radius you want. | 0 | 3,171 | 0 | 3 | 2010-07-03T19:03:00.000 | python,blender | How to draw a spherical triangle on a sphere in 3D? | 0 | 1 | 2 | 3,172,669 | 1 |
0 | 0 | I've recently started using a mac, and I'm curious about how to make a mac app that uses PyQt and is self-contained.
Can anyone give me any pointers on where to start and what I'll need? | false | 3,173,047 | 0.066568 | 0 | 0 | 1 | I've tried the same for some weeks now. Finally i have to say py2app just wont do. I was lucky with pyinstaller1.4. Although you need to add some minor modifications to run flawlessly on OS X. Furthermore the apps it creates are only 1/4 of the size compared to py2app. And most important it works :) And yet another goodie ... it works with the python framework which ships with OS X so there is no need to install python via MacPorts etc. | 0 | 1,222 | 0 | 2 | 2010-07-03T22:26:00.000 | python,macos,qt | How to create a self contained Python Qt app on mac | 0 | 1 | 3 | 4,022,382 | 1 |
0 | 0 | Installed the IronPython tools for VS 2010 but it didn't associate the *.py files to VS, neither did it (obviously) change the *.py files' icon.
How do I do that in Windows 7? | false | 3,177,918 | 0.291313 | 0 | 0 | 3 | I also had this issue. Here is what I did.
Right click on a python program.
Select properties.
You will find "opens with" option in the general tab.
Click change and select "python.exe".
Now, you will have your python icons back for all .py type of files. | 1 | 4,332 | 0 | 1 | 2010-07-05T08:03:00.000 | visual-studio-2010,windows-7,ironpython,file-type,root | How to make *.py files have the python icon in Win7? | 0 | 1 | 2 | 32,558,068 | 1 |
0 | 0 | i have just received a task to implement a software that paints over pictures (pretty much like microsoft paint )
i have no idea where to start or how to do that. do anyone have a good reference or idea for painting in qt or pyqt ?
this will be highly appreciated
thanks in advance | false | 3,179,469 | 0 | 0 | 0 | 0 | Have you looked at the scribble example included in PyQt? It does basic drawing, saving, loading, etc. | 1 | 1,562 | 0 | 0 | 2010-07-05T12:34:00.000 | python,qt,pyqt,paint | making paint in pyqt or qt | 0 | 1 | 3 | 3,497,327 | 1 |
0 | 0 | is it possible to connect a href link in QTextBrowser to a slot?
I want to make something that looks like a link in a QTextBrowser, but when user clicked on it, it will call one of the methods.
Is that possible?
if that is not, what is a good alternative?
Thanks in advance. | true | 3,186,576 | 1.2 | 0 | 0 | 1 | i finally found out how.
there's a signal call anchorClicked(QUrl)
that should do the trick :) | 0 | 198 | 0 | 0 | 2010-07-06T13:28:00.000 | python,pyqt4 | is it possible to connect a href link in QTextBrowser to a slot? | 0 | 1 | 1 | 3,187,108 | 1 |
0 | 0 | Are there any downsides in Python to using a library that is just a binding to a C library? Does that hurt the portability of your application? Anything else I should look out for? | false | 3,190,013 | 0 | 1 | 0 | 0 | Portability is one thing. There are even differences between python 2.x and 3.x that can make things difficult with C extensions, if the writer didn't update them.
Another thing is that pure python code gives you a bit more possibilities to read, understand and even modify (although it is usually a bad sign if you need to do that for other peoples modules) | 0 | 146 | 0 | 1 | 2010-07-06T20:35:00.000 | python | What are the pros and cons in Python of using a c library vs a native python one | 0 | 3 | 3 | 3,190,568 | 1 |
0 | 0 | Are there any downsides in Python to using a library that is just a binding to a C library? Does that hurt the portability of your application? Anything else I should look out for? | false | 3,190,013 | 0.26052 | 1 | 0 | 4 | C library is likely to have better performance, but needs to be recompiled for each platform.
You can't use C libraries on Google App Engine | 0 | 146 | 0 | 1 | 2010-07-06T20:35:00.000 | python | What are the pros and cons in Python of using a c library vs a native python one | 0 | 3 | 3 | 3,190,053 | 1 |
0 | 0 | Are there any downsides in Python to using a library that is just a binding to a C library? Does that hurt the portability of your application? Anything else I should look out for? | true | 3,190,013 | 1.2 | 1 | 0 | 4 | Of course using a C library hurts portability. It also prohibites you (in general) to use Jython or IronPython. I would only use a C library if I had no other option. This could happen if direct access to hardware is necessary or if special efficiency requirements apply. | 0 | 146 | 0 | 1 | 2010-07-06T20:35:00.000 | python | What are the pros and cons in Python of using a c library vs a native python one | 0 | 3 | 3 | 3,190,035 | 1 |
0 | 0 | Me and a friend are developing an application which uses Boost::Python. I have defined an interface in C++ (well a pure virtual class), exposed through Boost::Python to the users, who have to inherit from it and create a class, which the application takes and uses for some callback mechanism.
Everything that far goes pretty well. Now, the function callback may take some time (the user may have programmed some heavy stuff)... but we need to repaint the window, so it doesn't look "stuck".We wanted to use Boost::Thread for this. Only one callback will be running at a time (no other threads will call python at the same time), so we thought it wouldn't be such a great deal... since we don't use threads inside python, nor in the C++ code wrapped for python.
What we do is calling PyEval_InitThreads() just after Py_Initialize(), then, before calling the function callback inside it's own boost thread, we use the macro PY_BEGIN_ALLOW_THREADS and, and the macro PY_END_ALLOW_THREADS when the thread has ended.
I think I don't need to say the execution never reaches the second macro. It shows several errors everytime it runs... but t's always while calling the actual callback. I have googled a lot, even read some of the PEP docs regarding threads, but they all talk about threading inside the python module (which I don't sice it's just a pure virtual class exposed) or threading inside python, not about the main application calling Python from several threads.
Please help, this has been frustrating me for several hours.
Ps. help! | false | 3,197,236 | 0.197375 | 0 | 0 | 1 | Python can be called from multiple threads serially, I don't think that's a problem. It sounds to me like your errors are just coming from bad C++ code, as you said the errors happened after PY_BEGIN_ALLOW_THREADS and before PY_END_ALLOW_THREADS.
If you know that's not true, can you post a little more of your actual code and show exactly where its erroring and exactly what errors its giving? | 1 | 511 | 0 | 7 | 2010-07-07T17:19:00.000 | c++,python,boost-thread,boost-python | Problems regarding Boost::Python and Boost::Threads | 0 | 1 | 1 | 3,223,165 | 1 |
0 | 0 | I am using Pygame to pageflip different stimuli on the screen. The problem is that pygame's flip function, although syncing the flip to the vertical retrace, does not tell me when the retrace was.
Does anyone know of a way to get this information (preferably platform independent) in Python?
Regards,
fladd | false | 3,201,685 | 0 | 0 | 0 | 0 | Just poll for the time immediately after the flip call, if that one syncs to the vertical retrace. | 0 | 153 | 0 | 0 | 2010-07-08T08:07:00.000 | python,pygame,flip | How to get the point in time of (last) vertical retrace under Python? | 0 | 1 | 1 | 3,201,723 | 1 |
0 | 0 | I am having a bit of trouble with the Tkinter grid() manager. It is spacing the rows too far apart. I have two entry widgets to place, and I need one almost directly under the other. When I place them both on the same row and column, but change the pady option, it places them directly on top of each other. I know there has to be a way to fix this, never had this problem before.
I am using Python 2.6 on Windows XP. | true | 3,219,765 | 1.2 | 0 | 0 | 2 | Don't place them in the same row and column; place the upper in a row, and the lower in row+1, both in the same column. That does the trick.
Note that the grid manager does not need to have all rows and columns filled with widgets; it ignores empty rows and columns. | 0 | 1,716 | 0 | 1 | 2010-07-10T15:23:00.000 | python,tkinter,grid,tkinter-entry | Tkinter grid() Manager | 0 | 1 | 2 | 3,222,439 | 1 |
0 | 0 | A primary reason to use wx.SpinCtrl is to restrict the user to input integers, therefore I think that the text inside it would look better if right-aligned.
Is there a way to do this in wxPython? | true | 3,252,671 | 1.2 | 0 | 0 | 1 | Actually, there is a control you can use. It's called FloatSpin, which is in the agw sub-library. If you don't already have it, download the wxPython demo and check it out!
Mike | 0 | 435 | 0 | 0 | 2010-07-15T05:20:00.000 | python,wxpython,alignment,spinner | wxPython: Right-align the numbers in a wx.SpinCtrl | 0 | 1 | 1 | 3,261,410 | 1 |
0 | 0 | I am running in ubuntu and I can code in python, without problem. I have tried to install pygame and to do make it so, I did:
sudo apt-get instal python-pygame
When I go into the python IDLE and write:
import pygame
I get:
Traceback (most recent call last):
File "", line 1, in
ImportError: No module named pygame
What can I do to solve this problem? I am forgetting something, or doing something wrong? | false | 3,264,024 | 0.049958 | 0 | 0 | 1 | If you don't like to download an unpack then install manually, you can use apt to install setuptools . After that you can use easy_install(or easy_install-2.7?) to install many python packages, including pygame, of course. | 1 | 9,872 | 0 | 3 | 2010-07-16T10:44:00.000 | python,ubuntu,pygame,python-idle | pygame not found | 0 | 3 | 4 | 9,820,042 | 1 |
0 | 0 | I am running in ubuntu and I can code in python, without problem. I have tried to install pygame and to do make it so, I did:
sudo apt-get instal python-pygame
When I go into the python IDLE and write:
import pygame
I get:
Traceback (most recent call last):
File "", line 1, in
ImportError: No module named pygame
What can I do to solve this problem? I am forgetting something, or doing something wrong? | false | 3,264,024 | 0.049958 | 0 | 0 | 1 | I just had this same problem!
I read this and while it works to do the sys.path.append thing, I decided to try and get it to work with out.
What I did was went to the Ubuntu Software center uninstalled the python IDLE i had installed and then installed the IDLE.
This seems confusing the way I said it so to clarify you want to download the IDLE that doesn't come with its own version of python, it'll then use the python that already comes with Ubuntu!
If this doesn't make since or doesn't help fix your problem let me know! | 1 | 9,872 | 0 | 3 | 2010-07-16T10:44:00.000 | python,ubuntu,pygame,python-idle | pygame not found | 0 | 3 | 4 | 14,076,665 | 1 |
0 | 0 | I am running in ubuntu and I can code in python, without problem. I have tried to install pygame and to do make it so, I did:
sudo apt-get instal python-pygame
When I go into the python IDLE and write:
import pygame
I get:
Traceback (most recent call last):
File "", line 1, in
ImportError: No module named pygame
What can I do to solve this problem? I am forgetting something, or doing something wrong? | false | 3,264,024 | 0 | 0 | 0 | 0 | check that you are installing pygame for the right version of python. I think the pygame for python 2.7 won't work on python 3.3. I had the same problem but even after installing the right version it didn't work. So after a little googling I found that I was installing pygame meant for 32-bit but my os is 64-bit. so try to google "pygame for window 64-bit" or something like that. I hope it helps. | 1 | 9,872 | 0 | 3 | 2010-07-16T10:44:00.000 | python,ubuntu,pygame,python-idle | pygame not found | 0 | 3 | 4 | 17,222,436 | 1 |
0 | 0 | When I update my objectListView list it flickers/flashes white, is this normal behaviour or can it be prevented. The list gets updated around every 1-5 seconds using the AddObject method if that makes any difference. | true | 3,268,106 | 1.2 | 0 | 0 | 0 | I seem to have fixed it by using the FastObjectListView class instead... | 1 | 463 | 0 | 0 | 2010-07-16T19:14:00.000 | python,user-interface,wxpython,objectlistview | ObjectListView Flickers/Flashes when adding a new list object | 0 | 1 | 2 | 3,268,404 | 1 |
0 | 0 | Is there a wxpython list widget that displays alternating row colours even when empty the list is empty? or Is there even one that will display a background colour(other than white) when it is empty? | true | 3,269,019 | 1.2 | 0 | 0 | 1 | You could do it with a wx.Grid or you might look at the new UltimateListCtrl, which is a pure python widget. You can hack it if it doesn't do what you want it to! | 0 | 843 | 0 | 0 | 2010-07-16T21:35:00.000 | python,user-interface,listview,wxpython,background-color | Is there a wxpython list widget that displays alternating row colours even when the list is empty? | 0 | 1 | 2 | 3,269,998 | 1 |
0 | 0 | So I am trying to write a rich text editor in PyGTK, and originally used the older, third party script InteractivePangoBuffer from Gourmet to do this. While it worked alright, there were still plenty of bugs with it which made it frustrating to use at times, so I decided to write my own utilizing text tags. I have got them displaying and generally working alright, but now I am stuck at trying to figure out how to export them to a file when saving. I've seen that others have had the same problem I've had, though I haven't seen any solutions. I haven't come across any function (built in or otherwise) which comes close to actually getting the starting and ending position of each piece of text with a texttag applied to it so I can use it.
I have come up with one idea which should theoretically work, by walking the text by utilizing gtk.TextBuffer.get_iter_at_offset(), gtk.TextIter.get_offset(), gtk.TextIter.begins_tag(), and gtk.TextIter.ends_tag() in order to check each and every character to see if it begins or ends a tag and, if so, put the appropriate code. This would be horribly inefficient and slow, especially on larger documents, however, so I am wondering if anyone has any better solutions? | true | 3,269,942 | 1.2 | 0 | 0 | 0 | You can probably use gtk.TextIter.forward_to_tag_toggle(). I.e. loop over all tags you have and for each tags scan the buffer for the position where it is toggled. | 0 | 276 | 0 | 1 | 2010-07-17T02:05:00.000 | python,pygtk | Saving gtk.TextTags to file? | 0 | 1 | 1 | 3,271,663 | 1 |
0 | 0 | I have a Python program uses Qt (PyQt4 in fact) and when I launch it from its main.py, I get a console window and the GUI window (on Windows, of course).
Then I compile my program with py2exe and main.exe is successfully created. However, if I run main.exe (this is what users of program will do) console window of Python still appears and all my debug text is stdout-ed to that window.
I want to hide cmd line window when my application is running and I want just my GUI to be visible to the user when executed from .exe file.
Is that possible? | false | 3,275,293 | 1 | 0 | 0 | 6 | I doubt this has an effect on py2exe, but it's related to the question. To run a python GUI on windows without the terminal, use pythonw.exe instead of python.exe. This should happen automatically if you end the filename with ".pyw". | 0 | 19,469 | 0 | 20 | 2010-07-18T11:17:00.000 | python,pyqt,pyqt4,py2exe | Hiding console window of Python GUI app with py2exe | 0 | 1 | 4 | 3,275,651 | 1 |
0 | 0 | I'm working on a plugin for some software that I'm planning on selling someday. The software I'm making it for has both a C++ SDK and a Python SDK.
The C++ SDK documentation appears incomplete in certain areas and isn't documented that well.
The Python SDK docs appear more complete and in general are much easier to work with.
So I'm trying to decide if I want to go through the potential trouble of building a C++ plugin instead of a Python plugin to sell. About the only thing that makes me want to do a C++ plugin is that in my mind, a "C++ plugin" might be an easier sell than a "Python plugin". A lot of programmers out there don't even considered writing Python to be real "programming".
Do you think that potential customers might say "Why would I pay money for a measly little Python script?"? As opposed to "Oh it was written in C++ so the guy must be a decent programmer"?
Writing the Python plugin would be faster. Both plugins would look and behave exactly the same. The C++ plugin might be faster in certain spots, but for the type of plugin this is, that's not a huge deal.
So my question is, would a Python plugin be considered not as professional/sellable as a C++ plugin, even if it looks and acts EXACTLY the same as a C++ plugin? | false | 3,277,376 | 0 | 1 | 0 | 0 | Python will also have the advantage/disadvantage (depending on what you want) that the source code must be open. (I think delivering only the .pyc file is not really an option as the Python bytecode format is changing in every release.)
Otherwise, let's say you are selling to people who don't really know what the difference is between Python/C++: The outcome is the important thing. If your Python plugin runs and feels stable and fast, it is fine.
If they have heard about both languages, there really may be a difference. I must admit, if I had a choice between two plugins which do exactly the same and which are perfectly stable from all user reports, I probably would prefer the C++ plugin. It would be my intuition which would tell me that the C++ code is probably slightly more stable and faster. This is also for Unix tools and other stuff. | 0 | 815 | 0 | 3 | 2010-07-18T21:42:00.000 | c++,python | Is Python-based software considered less-professional than C++/compiled software? | 0 | 3 | 4 | 3,277,408 | 1 |
0 | 0 | I'm working on a plugin for some software that I'm planning on selling someday. The software I'm making it for has both a C++ SDK and a Python SDK.
The C++ SDK documentation appears incomplete in certain areas and isn't documented that well.
The Python SDK docs appear more complete and in general are much easier to work with.
So I'm trying to decide if I want to go through the potential trouble of building a C++ plugin instead of a Python plugin to sell. About the only thing that makes me want to do a C++ plugin is that in my mind, a "C++ plugin" might be an easier sell than a "Python plugin". A lot of programmers out there don't even considered writing Python to be real "programming".
Do you think that potential customers might say "Why would I pay money for a measly little Python script?"? As opposed to "Oh it was written in C++ so the guy must be a decent programmer"?
Writing the Python plugin would be faster. Both plugins would look and behave exactly the same. The C++ plugin might be faster in certain spots, but for the type of plugin this is, that's not a huge deal.
So my question is, would a Python plugin be considered not as professional/sellable as a C++ plugin, even if it looks and acts EXACTLY the same as a C++ plugin? | true | 3,277,376 | 1.2 | 1 | 0 | 6 | A lot of programmers out there don't even considered writing Python to be real "programming".
A lot of "programmers" out there are incompetent, too.
Do you think that potential customers might say "Why would I pay money for a measly little Python script?"?
I'm sure it depends on the type of software, but I can tell you that my program's customers have little interest in what we use to develop our product, and I doubt most of them know that the software is written in C++. They just care that it works.
So my question is, would a Python plugin be considered not as professional/sellable as a C++ plugin, even if it looks and acts EXACTLY the same as a C++ plugin?
No. | 0 | 815 | 0 | 3 | 2010-07-18T21:42:00.000 | c++,python | Is Python-based software considered less-professional than C++/compiled software? | 0 | 3 | 4 | 3,277,400 | 1 |
0 | 0 | I'm working on a plugin for some software that I'm planning on selling someday. The software I'm making it for has both a C++ SDK and a Python SDK.
The C++ SDK documentation appears incomplete in certain areas and isn't documented that well.
The Python SDK docs appear more complete and in general are much easier to work with.
So I'm trying to decide if I want to go through the potential trouble of building a C++ plugin instead of a Python plugin to sell. About the only thing that makes me want to do a C++ plugin is that in my mind, a "C++ plugin" might be an easier sell than a "Python plugin". A lot of programmers out there don't even considered writing Python to be real "programming".
Do you think that potential customers might say "Why would I pay money for a measly little Python script?"? As opposed to "Oh it was written in C++ so the guy must be a decent programmer"?
Writing the Python plugin would be faster. Both plugins would look and behave exactly the same. The C++ plugin might be faster in certain spots, but for the type of plugin this is, that's not a huge deal.
So my question is, would a Python plugin be considered not as professional/sellable as a C++ plugin, even if it looks and acts EXACTLY the same as a C++ plugin? | false | 3,277,376 | 0 | 1 | 0 | 0 | I think it doesn't matter. It all come down to 'use the right tool for the right job'. Your primary goal should be to make the best plugin you can. So if you feel more at ease with Python use that. It will probably take you less time to write. The client probably doesn't mind it and just want the most stable, reliable, cheapest, easiest to use plugin. So concentrate on that not on the tool. | 0 | 815 | 0 | 3 | 2010-07-18T21:42:00.000 | c++,python | Is Python-based software considered less-professional than C++/compiled software? | 0 | 3 | 4 | 3,277,403 | 1 |
0 | 0 | What would be the best way to use negative coordinates in pygame?
At the moment I have a surface that is 1.5 times the original surface then everything that needs to be drawn is shifted up by a certain amount (to ensure the negative coordinates become positive) and drawn.
Is there an easier/alternate way of doing this? | false | 3,279,436 | 0 | 0 | 0 | 0 | There is no way to move the origin of a surface from 0,0.
Implement your own drawing class which transforms all the coordinates passed in into the space of the surface. | 0 | 2,454 | 0 | 2 | 2010-07-19T08:22:00.000 | python,pygame,coordinates,geometry-surface | Negative coordinates in pygame | 0 | 1 | 3 | 3,279,476 | 1 |
0 | 0 | Is there any way to run a python script that utilizes TKinter on a web page such that a user could run the script and interact with the TK windows without having to download the script or have the appropriate python interpreter? | false | 3,284,779 | 0.099668 | 0 | 0 | 1 | No. There is no way to do this. | 0 | 944 | 0 | 0 | 2010-07-19T20:27:00.000 | python,tkinter | Any way to run python TK scripts on web page? | 0 | 1 | 2 | 3,284,846 | 1 |
0 | 0 | I'm wanting a paradigm in a Qt4 (PyQt4) program where a component is able to respond to a signal without knowing anything about where it is coming from.
My intial reading suggests that I have to explicitly connect signals to slots. But what I want is for any of a number of components to be able to send a signal, and for it to be processed by another component.
Comparing with another toolkits, for example, in wxWidgets I would use events. These automatically propogate up from child windows/objects to parents. At each level they can be handled. This means if I have a lot of children which may emit the same event, I don't have to explicitly connect all of them to the handler. I can just put the handler in the parent, or some higher level in the window hierarchy. This means that only the event generator and consumer need to know about the event at all. The consumer doesn't need to know where the source of the event is, how many such sources there are, or anything else about it.
Is this possible in Qt - is there another approach? Maybe there is an alternative event mechanism to signals and slots? | false | 3,286,826 | 0 | 0 | 0 | 0 | Signal handlers do NOT know the emitter (only the signal type) and emitters do NOT know what handlers are connected. Many handlers can connect to the same signal and they are executed in the order of connection. A signal can be emitted from many places. | 0 | 1,116 | 0 | 3 | 2010-07-20T03:36:00.000 | python,qt4,pyqt,signals | How to broadcast a signal in Qt4 | 0 | 3 | 3 | 8,453,598 | 1 |
0 | 0 | I'm wanting a paradigm in a Qt4 (PyQt4) program where a component is able to respond to a signal without knowing anything about where it is coming from.
My intial reading suggests that I have to explicitly connect signals to slots. But what I want is for any of a number of components to be able to send a signal, and for it to be processed by another component.
Comparing with another toolkits, for example, in wxWidgets I would use events. These automatically propogate up from child windows/objects to parents. At each level they can be handled. This means if I have a lot of children which may emit the same event, I don't have to explicitly connect all of them to the handler. I can just put the handler in the parent, or some higher level in the window hierarchy. This means that only the event generator and consumer need to know about the event at all. The consumer doesn't need to know where the source of the event is, how many such sources there are, or anything else about it.
Is this possible in Qt - is there another approach? Maybe there is an alternative event mechanism to signals and slots? | false | 3,286,826 | 0.066568 | 0 | 0 | 1 | This isn't easily possible - you have to have something that knows about the signaling object and the receiving object to connect the two. Depending on what you need, however, you might be able to set up a class that mediates between the two (so objects with signals tell the class they exist, and have such-and-such a signal, while objects with slots tell the class they exist and have such-and-such a slot to connect to a given signal, and the mediator class tracks both of those, making connections when necessary). | 0 | 1,116 | 0 | 3 | 2010-07-20T03:36:00.000 | python,qt4,pyqt,signals | How to broadcast a signal in Qt4 | 0 | 3 | 3 | 3,292,687 | 1 |
0 | 0 | I'm wanting a paradigm in a Qt4 (PyQt4) program where a component is able to respond to a signal without knowing anything about where it is coming from.
My intial reading suggests that I have to explicitly connect signals to slots. But what I want is for any of a number of components to be able to send a signal, and for it to be processed by another component.
Comparing with another toolkits, for example, in wxWidgets I would use events. These automatically propogate up from child windows/objects to parents. At each level they can be handled. This means if I have a lot of children which may emit the same event, I don't have to explicitly connect all of them to the handler. I can just put the handler in the parent, or some higher level in the window hierarchy. This means that only the event generator and consumer need to know about the event at all. The consumer doesn't need to know where the source of the event is, how many such sources there are, or anything else about it.
Is this possible in Qt - is there another approach? Maybe there is an alternative event mechanism to signals and slots? | false | 3,286,826 | 0 | 0 | 0 | 0 | Don't you just want a good old fashioned method invocation? The response is just the return value of the method. | 0 | 1,116 | 0 | 3 | 2010-07-20T03:36:00.000 | python,qt4,pyqt,signals | How to broadcast a signal in Qt4 | 0 | 3 | 3 | 3,300,104 | 1 |
1 | 0 | I am making a html window in wxpython and want to print it. Before that I need to enter user input (such as his name or such things ) in the html page. How to do that nicely?
Thanks in advance, | false | 3,287,455 | 0 | 0 | 0 | 0 | There are a couple of approaches that come to my mind. If it's like a form letter where only specific parts will be replaced, then you can just should that to the user and have some text controls for them to fill in. Something like this:
Dear #NAME,
Thank you for contacting #COMPANY, blah blah blah
And then have a text control for each of the replaceable parts. The other method would be to use the RichTextCtrl's Save As HTML functionality. See the wxPython Demo application for an example. | 0 | 614 | 0 | 2 | 2010-07-20T06:13:00.000 | python,wxpython,tags | How to insert dynamic string in wxpython html window? (wx.html.htmlwindow) | 0 | 1 | 2 | 3,294,064 | 1 |
0 | 0 | I need to get the mouse position relative to the tkinter window. | false | 3,288,047 | 0.291313 | 0 | 0 | 3 | Get the screen coordinates of the mouse move event (x/y_root) and subtract the screen coordinates of the window (window.winfo_rootx()/y()). | 0 | 9,025 | 0 | 5 | 2010-07-20T08:05:00.000 | python,tkinter,mouse-position | How do I get mouse position relative to the parent widget in tkinter? | 0 | 1 | 2 | 3,288,196 | 1 |
0 | 0 | When the user presses a close Button that I created, some tasks are performed before exiting. However, if the user clicks on the [X] button in the top-right of the window to close the window, I cannot perform these tasks.
How can I override what happens when the user clicks [X] button? | false | 3,295,270 | 0.099668 | 0 | 0 | 2 | The command you are looking for is wm_protocol, giving it "WM_DELETE_WINDOW" as the protocol to bind to. It lets you define a procedure to call when the window manager closes the window (which is what happens when you click the [x]). | 0 | 56,249 | 0 | 29 | 2010-07-20T23:46:00.000 | python,button,tkinter | Overriding Tkinter "X" button control (the button that close the window) | 0 | 1 | 4 | 3,295,508 | 1 |
0 | 0 | I'm confronted with the task of making a C++ app scriptable by users. The app has been in development for several years with no one wasting a thought on this before. It contains all sorts of niceties like multithreading, template wizardry and multiple inheritance. As the scripting language, Python is preferred, but Lua might be accepted if it is significantly easier to implement.
Question 1
From what I have learned so far, there are broadly speaking two ways to integrate Python/Lua with C++ : "extending" and "embedding".
In this case, it looks like I need both. The scripting language need access to objects, methods and data from the app but needs to be called by the app once the user has written the script - without restarting anything.
How is this usually done in the real world?
Question 2
There seems to be a bewildering array of of manual solutions and binding generators out there, all of them less than perfect.
swig, pyste, Py++, ctypes, Boost.Python sip, PyCXX, pybindgen, robin, (Cython/Pyrex, Weave)
CppLua, Diluculum, Luabind, Luabridge, LuaCpp, Luna/LunaWrapper, MLuaBind, MultiScript, OOLua, SLB, Sweet Lua, lux
(this list from the lua wiki)
CPB, tolua, tolua++, toLuaxx, luna and again swig
Most commments on these found on the web are a little out of date. For example, swig is said to be difficult in non-trivial cases and to generate incomprehensible code. OTOH, it has recently gone to v2.0.
Some of the above use pygccxml to let gcc analyze the C++ code and then genarate the binding. I find this idea appealing, as gcc probably understands the code better than i do :-). Does this work well?
Testing them all might easily cost me half of the time allocated for the whole project.
So, which ones do you recommend? | false | 3,299,067 | 0 | 1 | 0 | 0 | My experience may not be much, but I figure it's at least worth what you paid for it ;)
I've done some basic "hello world" python modules, and I couldn't really get into swig - it seemed like a lot of overhead for what I was doing. Of course it's also possible that it's just the right amount for your needs. | 0 | 1,926 | 0 | 12 | 2010-07-21T12:18:00.000 | c++,python,binding,lua,scriptable | How do I make a nasty C++ program scriptable with Python and/or Lua? | 0 | 3 | 5 | 3,299,189 | 1 |
0 | 0 | I'm confronted with the task of making a C++ app scriptable by users. The app has been in development for several years with no one wasting a thought on this before. It contains all sorts of niceties like multithreading, template wizardry and multiple inheritance. As the scripting language, Python is preferred, but Lua might be accepted if it is significantly easier to implement.
Question 1
From what I have learned so far, there are broadly speaking two ways to integrate Python/Lua with C++ : "extending" and "embedding".
In this case, it looks like I need both. The scripting language need access to objects, methods and data from the app but needs to be called by the app once the user has written the script - without restarting anything.
How is this usually done in the real world?
Question 2
There seems to be a bewildering array of of manual solutions and binding generators out there, all of them less than perfect.
swig, pyste, Py++, ctypes, Boost.Python sip, PyCXX, pybindgen, robin, (Cython/Pyrex, Weave)
CppLua, Diluculum, Luabind, Luabridge, LuaCpp, Luna/LunaWrapper, MLuaBind, MultiScript, OOLua, SLB, Sweet Lua, lux
(this list from the lua wiki)
CPB, tolua, tolua++, toLuaxx, luna and again swig
Most commments on these found on the web are a little out of date. For example, swig is said to be difficult in non-trivial cases and to generate incomprehensible code. OTOH, it has recently gone to v2.0.
Some of the above use pygccxml to let gcc analyze the C++ code and then genarate the binding. I find this idea appealing, as gcc probably understands the code better than i do :-). Does this work well?
Testing them all might easily cost me half of the time allocated for the whole project.
So, which ones do you recommend? | false | 3,299,067 | 0 | 1 | 0 | 0 | Try Boost::Python, it has somewhat of a learning curve associated with it but it is the best tool for the job in my view, we have a huge real time system and developed the scripting library for the QA in Boost::Python. | 0 | 1,926 | 0 | 12 | 2010-07-21T12:18:00.000 | c++,python,binding,lua,scriptable | How do I make a nasty C++ program scriptable with Python and/or Lua? | 0 | 3 | 5 | 3,299,415 | 1 |
0 | 0 | I'm confronted with the task of making a C++ app scriptable by users. The app has been in development for several years with no one wasting a thought on this before. It contains all sorts of niceties like multithreading, template wizardry and multiple inheritance. As the scripting language, Python is preferred, but Lua might be accepted if it is significantly easier to implement.
Question 1
From what I have learned so far, there are broadly speaking two ways to integrate Python/Lua with C++ : "extending" and "embedding".
In this case, it looks like I need both. The scripting language need access to objects, methods and data from the app but needs to be called by the app once the user has written the script - without restarting anything.
How is this usually done in the real world?
Question 2
There seems to be a bewildering array of of manual solutions and binding generators out there, all of them less than perfect.
swig, pyste, Py++, ctypes, Boost.Python sip, PyCXX, pybindgen, robin, (Cython/Pyrex, Weave)
CppLua, Diluculum, Luabind, Luabridge, LuaCpp, Luna/LunaWrapper, MLuaBind, MultiScript, OOLua, SLB, Sweet Lua, lux
(this list from the lua wiki)
CPB, tolua, tolua++, toLuaxx, luna and again swig
Most commments on these found on the web are a little out of date. For example, swig is said to be difficult in non-trivial cases and to generate incomprehensible code. OTOH, it has recently gone to v2.0.
Some of the above use pygccxml to let gcc analyze the C++ code and then genarate the binding. I find this idea appealing, as gcc probably understands the code better than i do :-). Does this work well?
Testing them all might easily cost me half of the time allocated for the whole project.
So, which ones do you recommend? | false | 3,299,067 | 1 | 1 | 0 | 12 | I wouldn't recommend swig as it's hard to get it to generate satisfactory binding in complex situations: been there, done that. I had to write a horrible script that "parsed" the original C++ code to generate some acceptable C++ code that swig could chew and generate acceptable bindings. So, in general: avoid ANY solution that relies on parsing the original C++ program.
Between Lua and Python: I have found Lua MUCH, MUCH better documented and more cleanly implemented. Python has a GIL (global lock), whereas with Lua, you can have an interpreter instance in each thread, for example.
So, if you can choose, I'd recommend Lua. It is smaller language, easier to comprehend, easier to embed (much cleaner and smaller API, with excellent documentation). I have used luabind for a small project of mine and found it easy to use. | 0 | 1,926 | 0 | 12 | 2010-07-21T12:18:00.000 | c++,python,binding,lua,scriptable | How do I make a nasty C++ program scriptable with Python and/or Lua? | 0 | 3 | 5 | 3,299,174 | 1 |
0 | 0 | For a college project, I need to implement a GUI for a console app I wrote. For this I decided to use PyQt. I need only basic functionalities, such as designing a simple form with basic elements and displaying some texts on it.
Can anyone point me to a nice tutorial for learning PyQt? I really don't want to get into the details of Qt at this stage. | false | 3,300,182 | 0 | 0 | 0 | 0 | you need to see the orginal pyqt Examples
you need time for practice
you get Experience
you must specify a goal and start Researching about it. | 1 | 9,748 | 0 | 12 | 2010-07-21T14:15:00.000 | python,pyqt | Learning PyQt Quickly | 0 | 1 | 5 | 10,767,981 | 1 |
Subsets and Splits