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 will admit that starting programming on your own as a newbie can seem a bit daunting. However after toying around very basically in both Python and currently C++ I'm wondering if C may be more suitable for a hobbyist. By hobbyist I mean someone who foresees no real future in actually programming for a living but rather sees it (at least currently) as an interesting exercise. So while I would like to be able to do things I'm don't really see myself y'know making a 3d game engine.
I know that I don't NEED to learn C to learn C++. But from what I've read a couple of people have said that C is easier to learn because it's a smaller language. It seems like it would be more suitable to me given that, and I know that C is certainly fine for anything I'd want to do with it, and thus not really need to learn or use it as a stepping stone for C++. From what I can see C would be a) Easier to program with, meaning easier to get in and make things and keep one interested. b) lower level means more flexibility, whereas Python would be hindered perhaps by it's high level nature. C) Still widely used (though perhaps not to the extent of C++)
A lot of people ask about learning C to get to C++ but I'm wondering more about C's own merits in and of them self. I wonder if what I'm thinking is true or if I've been filled with misconceptions. Thanks for any help :)
| false | 7,909,666 | 0.291313 | 1 | 0 | 3 |
You're looking at this wrong. What's your goal? If your goal is to "learn a language" then you are wasting your time. That is like investing your time into learning to use photoshop with no ambition to ever create any neato graphics.
Instead of focusing on the tool, focus on what you want to do with it. If I learn how to use a power saw it's probably because I want to build something out of wood, not because I think power saws are just really awesome.
Ask yourself; what do I want to build? Once you answer that then you set forth finding out which tools would be most appropriate.
| 1 | 784 | 0 | 2 |
2011-10-26T22:23:00.000
|
c++,python,c
|
Learning programming as a hobbyist... the merits of C vs C++
| 0 | 1 | 2 | 7,909,723 | 1 |
0 | 1 |
I recently downloaded OpenCV 2.3.1, compiled with the CMake flags withQt and withQtOpenGL turned on. My Qt version is 4.7.4 and is configured with OpenGL enabled. Supposedly I only need to copy cv2.pyd to Python's site-package path:
C:\Python27\Lib\site-packages
And in the mean time make sure the OpenCV dlls are somewhere in my PATH. However, when I try to call
import cv2
in ipython, it returned an error:
ImportError: DLL load failed: The specified procedure could not be found.
I also tried OpenCV 2.3, resulting the same error. If OpenCV is compiled without Qt, the import works just fine. Has anyone run into similar problem before? Or is there anyway to get more information, such as which procedure is missing from what DLL?
| false | 7,940,848 | 0 | 0 | 0 | 0 |
Probably need the qt dll's in the same place as the opencv dlls - and they have to be the version built with the same compiler as opencv (and possibly python)
| 0 | 488 | 0 | 2 |
2011-10-29T18:33:00.000
|
python,qt,opencv,import
|
Error when importing OpenCV python module (when built with Qt and QtOpenGL)
| 0 | 1 | 1 | 7,940,923 | 1 |
0 | 0 |
I use Qt4 Designer and I want that when I click on the "yes" button, some code will execute. And when I click on the "no", some other code will be execute. How can I do it?
| false | 7,964,869 | 1 | 0 | 0 | 7 |
Right-click on your widget
Select "Go to slot..."
Select a signal and click OK
Your custom slot declaration and definition for that signal will be added to *.cpp and *.h files. Its name will be generated automatically.
upd:
Sorry, I didn't notice that the question is about Python & QtDesigner itself, I was thinking of the designer mode in QtCreator IDE. However, this still may be useful for someone who is looking for Qt/C++ info, so I leave the answer.
| 0 | 38,462 | 0 | 22 |
2011-11-01T09:59:00.000
|
python,qt4,qt-designer
|
Qt Designer: how to add custom slot and code to a button
| 0 | 2 | 2 | 34,307,822 | 1 |
0 | 0 |
I use Qt4 Designer and I want that when I click on the "yes" button, some code will execute. And when I click on the "no", some other code will be execute. How can I do it?
| false | 7,964,869 | 1 | 0 | 0 | 45 |
Click on the Edit Signal/Slots tool.
Create a connection for your button. For this, select your button in the designer by pressing on it with the left button of the mouse. Move the mouse to some place in the main window to create a connection with the main window (it is like a red line with a earth connection).
When you release the mouse button, the Configure Connection dialog appears.
In this dialog select a signal in the left text control (the sender), for example, pressed().
Then press edit in the right text control (the receiver). A dialog for the Signals/Slots of MainWindow appears.
In the slot panel add a new slot (green cross). The text slot1() appears. Double click on it to edit the line and write instead the name of your function doit_when_yes_ispressed(). Accept.
Now in the Configure Connection dialog you will see your function in the right text control. Select and Accept.
In the designer now you can see the signal and your function in the widget.
| 0 | 38,462 | 0 | 22 |
2011-11-01T09:59:00.000
|
python,qt4,qt-designer
|
Qt Designer: how to add custom slot and code to a button
| 0 | 2 | 2 | 7,965,081 | 1 |
1 | 0 |
I wonder if there's a python GUI like pyqt etc. which works purely with html and javascript for layouting desktop applications...
Do you know if there are projects like this? Does this make sense at all ;-) Or it it just me finding that a nice tool...
| false | 7,967,575 | 0 | 0 | 0 | 0 |
you could always use django, django templates support html, js, css, php etc.
| 0 | 3,024 | 0 | 5 |
2011-11-01T13:59:00.000
|
python,html,css,user-interface
|
HTML/Javascript/CSS GUI for the development of desktop applications with python?
| 0 | 2 | 3 | 7,967,656 | 1 |
1 | 0 |
I wonder if there's a python GUI like pyqt etc. which works purely with html and javascript for layouting desktop applications...
Do you know if there are projects like this? Does this make sense at all ;-) Or it it just me finding that a nice tool...
| false | 7,967,575 | 0.132549 | 0 | 0 | 2 |
Since you mention PyQt yourself, you could perhaps just create a simple GUI using these tools, with your entire application made up of a QtWebKit module. Then just point to some files you created locally, and browse them using your appliction? But, this would not be any different compared to using a normal browser, so there's not really any point in doing this in my opinion...
| 0 | 3,024 | 0 | 5 |
2011-11-01T13:59:00.000
|
python,html,css,user-interface
|
HTML/Javascript/CSS GUI for the development of desktop applications with python?
| 0 | 2 | 3 | 7,967,652 | 1 |
0 | 0 |
I developed an application with wxPython and used cx_freeze to covert it to a .exe. I installed the app on WinXP and it works fine. My only misgiving is that the gui app is running with a command prompt behind it. How can I get rid of this command prompt? I imagine that it is there to display errors etc.... There must be a way to redirect errors to a log file instead of showing this command prompt? Thanks in advance.
Code:
| false | 7,970,055 | 0 | 0 | 0 | 0 |
You can rename your .py file to .pyw it will then run without displaying the console.
| 0 | 370 | 0 | 0 |
2011-11-01T17:06:00.000
|
windows,wxpython
|
Running a wxPython application in a Windows environment w/o the command prompt displaying
| 0 | 1 | 2 | 7,970,931 | 1 |
1 | 0 |
Can I port existing python scripts on android using SL4A or ASE ? What I specifically want to do is to create an android application with normal UI elements and run the python scripts from the application itself, get the output and display it. Is this possible ?
| false | 7,995,202 | 0 | 0 | 0 | 0 |
I think, what you want to do is make an independently apk file, that includes the python interpret and your script code.
I don't know if this can be done in Android. The only whay I know is running your script from Android Scripting Environment.
| 0 | 1,064 | 0 | 4 |
2011-11-03T12:53:00.000
|
android,python,sl4a
|
Android and Python
| 0 | 2 | 4 | 7,995,273 | 1 |
1 | 0 |
Can I port existing python scripts on android using SL4A or ASE ? What I specifically want to do is to create an android application with normal UI elements and run the python scripts from the application itself, get the output and display it. Is this possible ?
| true | 7,995,202 | 1.2 | 0 | 0 | 2 |
Personnaly I think that you ask implicitly for three points:
Compatibility Desktop/Mobile
The first is the compatibility between the python library on the phone and the python library in your computer. If you don't use third party library and be sure to include the extra python library provided by sl4a, you should generally be ok.
Packaging
The second point is about how to package a Python app for android. It can easily be done with a wrapper as well described on the sl4a website. In fact they distribute a copy of a chapter of a book about SL4A that describes how to do that. So that is possible, but bear in mind that the user will be required to install python if he hasn't done so already (this is a sort of alert at the launch of the app)
UI
The third thing that you should have in mind is that you are not a 100% free concerning the widget/layout you can use with sl4a. Namely you can't really do whatever you would be able to do in Java or Scala. So you might have to consider altering your UI and do a webview instead (that can communicate back and forth with the python) with a framework to obtain a "mobile look and feel"
Hope this helps.
| 0 | 1,064 | 0 | 4 |
2011-11-03T12:53:00.000
|
android,python,sl4a
|
Android and Python
| 0 | 2 | 4 | 7,995,341 | 1 |
0 | 0 |
I've got a pygtk app which uses gtk print_run_page_setup_dialog. For some reason, some widgets (siblings to button that invoked the dialog) are no more redrawn after closing this dialog. Forcibly calling queue_draw on them works fine.
I'd like to identify where are the events going, and reconnect them to proper location. How do I go about this problem?
| false | 8,008,220 | 0 | 0 | 0 | 0 |
It sounds incredibly unlikely that the dialog should somehow mess with event handler connections for unrelated widgets.
Make sure the dialog is not stuck in a nested main loop (the call you mention has run in its name, implying a call to gtk_main() is taking place to make the dialog modal).
| 0 | 43 | 0 | 0 |
2011-11-04T10:59:00.000
|
python,gtk,pygtk
|
Redraw events lost?
| 0 | 1 | 1 | 8,008,432 | 1 |
0 | 0 |
I am porting my console app to a QT gui. The app get data from a website and prints the rsult line by line in the console ( I use spyder). Each line are a few strings.
Now I want to add a gui to the app so others can use the app as well.
With QT designer I designed a nice gui. In a Main module I call the UI. Now I am trying to 'connect' my app to the gui. Since I am new to Qt (with PySide) I would like to build step by step and learn.
Now I would like to show ('print' line by line) the results in a widget (e.g. QListView).
Can you show me a example where ["this is line 1", "This is line two"] are show in two rows in a QT Widget.
Thanks
| false | 8,022,035 | 0.197375 | 0 | 0 | 1 |
I usually use QTextBrowser for a "logging" widget.
Just create a QTextBrowser widget in your main window (i.e. self.log_widget = QTextBrowser())
Add it to some layout to be visible and part of the window
Log messages to it with the append method (which accepts a string). (i.e. self.log_widget.append('Hello'))
QTextBrowser is a powerful widget that can also accept HTML for formatted output.
| 0 | 970 | 0 | 1 |
2011-11-05T17:46:00.000
|
python,qt,widget,pyside
|
Print results in Qt widget iso console
| 0 | 1 | 1 | 8,022,220 | 1 |
0 | 0 |
So I've been tinkering with a few different GUI's but I haven't been able to even find a point to begin researching this question:
How do I make a GUI like Steam (Digital distribution app) has? More specifically, I'm interested in how they manage to make their SHIFT+TAB menu pop up in-game, without disrupting/pausing/effecting the game. I've been somewhat successful in making a GUI window "stay on top" when a game is in window mode, but Steam pops this little menu up over the top of a running, fullscreen game.
That's what I'm interested in learning about. Any info would be much appreciated. :)
Sorry if this isn't the correct place to post this. I wasn't sure exactly where to ask.
PS> Preferably something I could implement in Python!!!
| false | 8,059,845 | -0.197375 | 0 | 0 | -2 |
Hmm, that looks very much like they are using Adobe AIR or maybe Flash.
| 0 | 1,878 | 0 | 0 |
2011-11-09T03:00:00.000
|
python,user-interface
|
Programming a GUI Like Steam?
| 0 | 1 | 2 | 8,059,885 | 1 |
0 | 0 |
I have a few functions written in C for a game project. These functions get called quite a lot (about 2000-4000 times per second). The functions are written in C for raw speed.
Now, the easiest way for me to include these functions into Python is to use ctypes. The alternative is to write a C extension to Python around these functions (which takes quite a bit of extra effort). So I wondered, not including the initial loading of the DLL, how big is the overhead of ctypes?
I'm using Python 2.7 (the standard CPython release), and I do not want to use an external library like Cython.
I know this question has been asked before, but I haven't seen much information about the performance comparison between the two options.
| true | 8,067,171 | 1.2 | 1 | 0 | 18 |
I've compared the performance of a C extension vs. a ctypes wrapper. In my particular test, the difference was about 250x. There were multiple calls into the C library so the ctypes wrapper was also executing Python code. The running time for the C library was very short which made the extra overhead for Python code even more significant. So the ratio will likely be different for you but was significant in my case.
| 0 | 7,501 | 0 | 25 |
2011-11-09T15:21:00.000
|
python,c,ctypes,overhead
|
ctypes vs C extension
| 0 | 2 | 2 | 8,069,179 | 1 |
0 | 0 |
I have a few functions written in C for a game project. These functions get called quite a lot (about 2000-4000 times per second). The functions are written in C for raw speed.
Now, the easiest way for me to include these functions into Python is to use ctypes. The alternative is to write a C extension to Python around these functions (which takes quite a bit of extra effort). So I wondered, not including the initial loading of the DLL, how big is the overhead of ctypes?
I'm using Python 2.7 (the standard CPython release), and I do not want to use an external library like Cython.
I know this question has been asked before, but I haven't seen much information about the performance comparison between the two options.
| false | 8,067,171 | 1 | 1 | 0 | 9 |
The directly C coded interface has the potential to be much much faster. The bottleneck is the interface from Python to C and marshalling arguments and results may for example involve copying strings or converting Python lists to/from C arrays. If you have a loop that makes several hundred of these calls and some of the data doesn't have to be marshalled separately for each call then all you have to do is recode the loop in C and you may be able to massively reduce the bottleneck. ctypes doesn't give you that option: all you can do is call the existing functions directly.
Of course that all depends on exactly what sort of functions you are calling and what sort of data you are passing around. It may be that you can't reduce the overheads in which case I would still expect ctypes to be slower but perhaps not significantly.
Your best best would be to put together some sample of your code written each way and benchmark it. Otherwise there are just too many variables for a definitive answer.
| 0 | 7,501 | 0 | 25 |
2011-11-09T15:21:00.000
|
python,c,ctypes,overhead
|
ctypes vs C extension
| 0 | 2 | 2 | 8,067,399 | 1 |
0 | 0 |
I've been requested to create an application with a webview in it.
I've tried to import QtWebKit module but I have this error:
Traceback (most recent call last): File "", line 1, in
ImportError:
dlopen(/Library/Python/2.6/site-packages/PyQt4/QtWebKit.so, 2): Symbol
not found: _kCFWebServicesProviderDefaultDisplayNameKey Referenced
from: /Library/Frameworks/QtWebKit.framework/Versions/4/QtWebKit
Expected in:
/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation
It's the only one module that returns this error. All other installed modules are ok. The file /Library/Python/2.6/site-packages/PyQt4/QtWebKit.so exists.
What could the problem be?
Thank you all.
| false | 8,077,703 | 0.197375 | 0 | 0 | 1 |
I was able to fix the problem by upgrading to MacOSX Lion, but if that is not an option I would just ensure that PyQt4 is not using qt4.8, which is where this issue was introduced. If I remember correctly, everything works well with qt4.7.4
| 0 | 503 | 0 | 1 |
2011-11-10T09:57:00.000
|
python,macos,pyqt,osx-leopard,qtwebkit
|
PyQt4 ImportError for QtWebKit on Mac OS Leopard
| 0 | 1 | 1 | 8,760,805 | 1 |
0 | 0 |
I started new clear Main Window project,
There are 4 Objects: MainWindow, centralWidget, menubar, and statusbar.
I need to set default layout inside the window, so probably for centralWidget.
But I didnt found way how to do it.
I can get LayoutWidget with some particular size into centralWidget.
But I want to set layout for the whole centralWidget.
| false | 8,095,062 | 0.099668 | 0 | 0 | 1 |
Add some widgets to the central widget first.
Then select the central widget and use the "Layout in a Grid", "Layout Vertically", etc buttons on the toolbar to add a main layout.
The layouts in the "Widget Box" side-bar are used for adding child layouts to a main layout.
| 0 | 2,793 | 0 | 1 |
2011-11-11T14:04:00.000
|
python,qt,pyqt
|
pyqt designer and layout for central widget
| 0 | 2 | 2 | 8,095,328 | 1 |
0 | 0 |
I started new clear Main Window project,
There are 4 Objects: MainWindow, centralWidget, menubar, and statusbar.
I need to set default layout inside the window, so probably for centralWidget.
But I didnt found way how to do it.
I can get LayoutWidget with some particular size into centralWidget.
But I want to set layout for the whole centralWidget.
| true | 8,095,062 | 1.2 | 0 | 0 | 3 |
Right click anywhere within your centralWidget go to the Lay Out sub menu and select the Layout you want. This will be applied automatically to all contents of your centralWidget.
In order to see how it works place inside it 2 or 3 push buttons and try changing the layouts.
| 0 | 2,793 | 0 | 1 |
2011-11-11T14:04:00.000
|
python,qt,pyqt
|
pyqt designer and layout for central widget
| 0 | 2 | 2 | 8,095,337 | 1 |
0 | 0 |
I am developing a software based on embedded Python and C++. I want to secure some of my python code and prevent people from copying it.
For now I am using PyRun_SimpleString to execute the python code and the string is generated using my C++ code.
If I use this method, will it secure the Python code from being copied?
| true | 8,116,901 | 1.2 | 0 | 0 | 0 |
So, as I understand it the actual program will not exist in the executable, either in python source form, nor in 'marshalled' form (basically .pyc image) or compiled form, though I guess it will exist in some encrypted or obfuscated form which is converted into python source at run time.
This definitely makes it harder to extract the code, but an attacker who can trace the code as it runs will be able to catch calls to PyRun_SimpleString and obtain the plain source.
It's a question of degree - how hard you want to work to make the job harder for the attacker.
You might want to look into the 'frozen module' facility which is in the python source. This basically allows '.pyc' images to compiled in as byte arrays, and imported at runtime by un-marshalling them. So there's never any plain text source, but there is the .pyc image which is reasonably easy to analyze if you find it in the image. Take it one step further and obfuscate the pyc image - now attacker needs to analyze or trace past the de-obfuscation, and still won't see plain source code.
| 1 | 409 | 0 | 1 |
2011-11-14T03:12:00.000
|
python,security,embed
|
Can python source code executed using PyRun_SimpleString be extracted?
| 0 | 1 | 1 | 8,116,988 | 1 |
0 | 0 |
I have a library and some head files, no c++ source code, I want to use it with python.
I tried py++, but gccxml report error.
I tried swig, but some many "undefined symbol" errors.
Are there some smart tools can do such things automatically?
| false | 8,119,799 | 0 | 0 | 0 | 0 |
This approach requires a bit a bit of work, and might not be feasible if you have a lot of functions, that you want to wrap/the functions use a lot of c++ intrinsic types as arguments/return values.
If that is not the case, you can define some c-wrapper functions, with the "extern c" keyword in front of them, with pure c arguments and return types. Compile and link the "wrapper functions" to your c++ library. Then you can use the ctypes module (from python) to call your wrapper functions, which then in turn call the c++ functions in your library.
| 0 | 2,475 | 0 | 3 |
2011-11-14T09:52:00.000
|
c++,python
|
How to wrap a c++ library for python?
| 0 | 1 | 3 | 8,120,273 | 1 |
0 | 0 |
I checked out wxPython and wxWidgets into two directories C:\dev\wx\wxPtyhon and C:\dev\wx\wxWidgets:
mkdir /D c:\dev\wx\
cd c:\dev\wx
git clone https://github.com/wxWidgets/wxPython.git
git clone https://github.com/wxWidgets/wxWidgets.git
I successfully build wxWidgets by running:
cd wxwidgets\build\msw
mingw32-make -f makefile.gcc MONOLITHIC=1 SHARED=1 UNICODE=1 BUILD=release
The problem is that when I try to build wxPython, it cannot find wx.h
WXWIN=c:\dev\wx\wxWidgets
:: Note c:\dev\wx\wxWidgets\include\wx\wx.h exists !
C:\dev\wx\wxPython>python setup.py COMPILER=mingw32 BUILD_GLCANVAS=0 BUILD_ACTIVEX=0 WX_CONFIG="wx-config" build_ext --inplace
Preparing CORE...
Preparing STC...
Preparing GIZMOS...
running build_ext
running build_ext
building '_core_' extension
c:\dev\mingw\bin\gcc.exe -mno-cygwin -mdll -O -Wall -DSWIG_TYPE_TABLE=_wxPython_table -DSWIG_PYTHON_OUTPUT_TUPLE -DWXP_USE_THREA
D=1 -UNDEBUG -Iinclude -Isrc -IC:\Python25\include -IC:\Python25\PC -c src/helpers.cpp -o build\temp.win32-2.5\Release\src\helpe
rs.o -O3
In file included from src/helpers.cpp:17:0:
include/wx/wxPython/wxPython_int.h:35:19: fatal error: wx/wx.h: No such file or directory
compilation terminated.
error: command 'gcc' failed with exit status 1
| false | 8,125,968 | 0.197375 | 0 | 0 | 1 |
On Linux I got what seemed like an identical error.
I removed the error in this manner:
I used the find command to get a list of wx-config programs
From the list, I chose a wx-config that seemed right & used
its full path for WX_CONFIG
| 0 | 727 | 0 | 1 |
2011-11-14T18:01:00.000
|
wxpython,wxwidgets
|
How to build wxPython trunk with mingw on Windows?
| 0 | 1 | 1 | 10,554,783 | 1 |
0 | 0 |
I am trying to import a python library into SL4A. From my understanding, the easiest way to do this is to import the zipped files (egg files) of the python library into the SD Card and then import it into SL4A. Since I do not have an android device yet, I am working with the emulator. Whenever I try to push the zipped folder using the adb push command, it pops out an error saying the device is not connected. How do I push zipped files into the SD Card of an emulator and then access it via SL4A ? I want to use the commands in that library in the command line in SL4A.
Thanks !
| true | 8,141,746 | 1.2 | 0 | 0 | 0 |
You can create your own sdcard image, put files on it and after that mount in emulator.
To create image you can use mksdcard <size> <file>: mksdcard 1024M sdcard1.iso. After that you need to mount sdcard: mount -o loop sdcard1.iso /mnt/cdrom/. Next step: copy files, umount /mnt/cdrom/ and point to image in virtual machine properties.
| 0 | 1,245 | 0 | 0 |
2011-11-15T19:09:00.000
|
android,python,android-emulator,sl4a
|
ADB push command android emulator
| 0 | 1 | 1 | 8,142,934 | 1 |
0 | 0 |
I'm a beginning programmer and i need a way to get python to recognize a keyboard event. So far i can only find these methods in vPython or tkinter, and i want to simply use the normal python shell. if anyone can help me with a module name/where i could download a module for free that would be very helpful. or simply the code if there is no need for a module.Thanks
| false | 8,161,108 | 0.197375 | 0 | 0 | 1 |
There is no generic "keyboard event", they all depend on what your environment is.
In a terminal there are no keyboard events at all, you simply get sent text on stdin. In Windows you need to use the Win32, on Unix you need to use the X11 API and on Mac you have to use whatever OS X uses is it Cocoa?). wxPython and tkinter all work on all these platforms to provide an API that works on all of them. And the same goes for other GUI toolkits of the same sort like KDE and GTK. So you should use one of those. Which one is a matter of taste, but since tkinter is included in Python, that seems the obvious choice.
You can call the respective API's for the respective platforms directly, but it's generally not worth the trouble.
| 0 | 318 | 0 | 0 |
2011-11-17T01:42:00.000
|
python-3.x,keyboard-events
|
Recognition of keyboard event in python
| 0 | 1 | 1 | 8,161,308 | 1 |
0 | 0 |
I need to add a popup dialog box on my GUI.
So, when ever I hover my mouse over a label, it should be able to show a popup( Like the type we get while hovering over a file in windows).
It should also disappear as soon i move away the mouse.
To start with, I am not even sure which module or class to use. I tried menu, but the results are not what i expected.
I also tried to learn tkCommonDialog, but couldn't understand it properly.
Please Advice!
| false | 8,163,195 | 0.066568 | 0 | 0 | 1 |
Take a look at the Balloon widget in the Tix package. I think it is just what you are looking for.
| 0 | 863 | 0 | 3 |
2011-11-17T06:50:00.000
|
python,popup,tkinter,tk,ttk
|
Popup Dialog in Tkinter/Python
| 0 | 1 | 3 | 8,183,103 | 1 |
0 | 0 |
So I'm coding Pacman in Python just for fun and I want to create pacman's open face (when he is eating food) using Tkinter graphics. How exactly do I draw an open face? I was thinking about using canvas.create_arc to create the open mouth but it doesn't work properly :(
Any help? Thanks!
| true | 8,176,599 | 1.2 | 0 | 0 | 2 |
You are correct that you would use the create_arc method. Set the start to 45 and the extent to 270 and it will look like pacman is facing to the right with his mouth open.
Since you are just learning I'll not post the exact code so you'll have a chance to figure it out on your own.
| 0 | 2,778 | 0 | 2 |
2011-11-18T01:10:00.000
|
python,tkinter,pacman
|
Drawing Pacman's Face in Tkinter
| 0 | 1 | 2 | 8,189,097 | 1 |
0 | 0 |
I want to create a simple project (the language doesn't really matter/but I prefer C++) which simply takes a window title as it's input and duplicate it's visual part, bit by bit, to a new window. just like a mirror better I'd say.
As far as I remember there was a win32 API for this but I can't remember, so would you please tell me how can I achieve this?
And please tell me, will your answers work with DirectX/Open-GL applications as well or not?
| false | 8,196,618 | 0 | 0 | 0 | 0 |
You can get DC of first window, and get DC of second window. And after this do BitBlt or StretchBlt. It has to work... But I don't know what about DirectX/Open-Gl... I think it has to work too. But anyway. It won't take much time to check it.
| 0 | 226 | 0 | 3 |
2011-11-19T19:24:00.000
|
c++,python,c,winapi,api
|
How to duplicate a window's clientarea to another window?
| 0 | 1 | 2 | 14,110,911 | 1 |
0 | 0 |
I have this cellphone which runs Android OS 2.6. Due to some reasons, I want to write code directly on my cellphone just as what we do in front of our PC.
So,
Can we make the Android cellphone a develop-platform? I mean write/compile/run C code on Android cellphones?
If we can, how?
| false | 8,200,317 | 0.066568 | 0 | 0 | 1 |
I installed sl4a which eventually gave me a sandboxed perl/python/tcl/lua enviroment. I then found their binaries in the shell and relocated them to my path so I could call them from cli. I also purchased c4droid and found that it had the tiny c binary in the shell.
| 0 | 4,409 | 0 | 2 |
2011-11-20T08:24:00.000
|
android,python,c,platform
|
Write C/C++/Python code on an Android cellphone
| 0 | 1 | 3 | 8,921,098 | 1 |
0 | 0 |
that it is possible to get the mouse position in wxpython using
event.GetPosition()
however, is it possible to get the position of a mouse in a sizer? Would this work even in an expanding sizer?
Thanks.
| true | 8,221,586 | 1.2 | 0 | 0 | 3 |
The X,Y position in a sizer is exactly the same as the window that the sizer belongs to, assuming that the sizer is the sizer assigned to that window. If you've got nested sizers then you can use sizer.GetPosition and sizer.GetSize to figure out if the position is inside that nested sizer.
However I would guess that the knowing the mouse position within the sizer is not going to be very useful. You are probably wanting to know which item within the sizer that the mouse position is over, like a HitTest type of method. You can implement something like that using the sizer.GetChildren() method and iterate over its items (they are wx.SizerItem objects) and look at the item's position and size to find the one that has the point within it. If the item is a sizer then you can recursively descend to that sizer and do the same thing until you find the leaf item at the desired point.
| 0 | 852 | 0 | 1 |
2011-11-22T03:22:00.000
|
python,wxpython
|
Get mouse position in sizer? wxpython
| 0 | 2 | 2 | 8,234,755 | 1 |
0 | 0 |
that it is possible to get the mouse position in wxpython using
event.GetPosition()
however, is it possible to get the position of a mouse in a sizer? Would this work even in an expanding sizer?
Thanks.
| false | 8,221,586 | 0 | 0 | 0 | 0 |
Sizers don't work with absolute positioning. They're for relative positioning. Sizers are the best at making your layout look right across multiple platforms and themes. If you really want to be able to insert stuff at specific x-y coordinates, then don't use a sizer.
| 0 | 852 | 0 | 1 |
2011-11-22T03:22:00.000
|
python,wxpython
|
Get mouse position in sizer? wxpython
| 0 | 2 | 2 | 8,234,664 | 1 |
0 | 0 |
I'm working on a monte carol pricer and I need to improve the efficiency of the engine.
MonteCarlo path are created by a third party library (in c++)
Pricing is done in IronPython (script created by the end user)
Everything else is driven by a c# application
the pricing process is as follow:
C# application request the path and collect them
C# application push the paths to the script, who price and return the values
C# application display the result to the end user
The number and size of the paths collected are know in advance.
I have 2 solutions with some advantages and drawback:
Request path generation, for each path, ask the script to return the result and finaaly aggregate the results once all paths are processed
Request path generation, collect all of them, request the script to process all of them at once and retrun me the final price
The first solutions work fine in all scenarios but as the number of path requested increase the performance decrease (I think it's due to the multiple call to ironpython)
The second solution is faster but can hit an "out of memory" exception (I think it's not enough virtual memory addressing space) if the number of path requested is too large
I choose the middle ground and process a bunch of path then aggregate the prices.
What I want now is to increase the performance futher by knowing in advance how many path I can process withou hitting the "out of memory" exception
I did the math and I know in advance the size (in memory) of path for a given request. However because I'm quiet sure it's not a memory problem but more virtual memory addressing issue
So all this text is summarize by the following 2 questions:
Is it possible to know in advance how much virtual memory address my
process wil need to store n instance of a class (size in memory and structure are known)?
Is it possible to know how much virtual memory address are still available for my process
btw I'm working on the 32 bit computer
Thanks in advance for the help
| true | 8,257,686 | 1.2 | 1 | 0 | 1 |
Finding out how much memory an object takes in .NET is a pretty difficult task. I've hit the same problem several times. There are some imperfect methods, but none are very precise.
My suggestion is to get some estimate of how much a path will take, and then pass a bunch of them leaving a good margin of safety. Even if you're processing them just 10 at a time, you've reduced the overhead 10 times already.
You can even make the margin configurable and then tweak it until you strike a good balance. An even more elegant solution would be to run the whole thing in another process and if it hits an OutOfMemoryException, restart the calculation with less items (and adjust the margin accordingly). However, if you have so much data that it runs out of memory, then it might be a bit slow to pass it across two processes (which will also duplicate the data).
Could it be that the memory overflow is because of some imperfections in the path processor? Memory leaks maybe? Those are possible both in C++ and .NET.
| 1 | 871 | 0 | 3 |
2011-11-24T13:16:00.000
|
c#,memory-management,ironpython
|
Virtual memory address management in c#
| 0 | 1 | 2 | 8,257,843 | 1 |
0 | 0 |
I've tested pyglet and I'm sure pyglet works well.
But when I ran the script in samples/hello_world_actions.py , or anything with color, only thing in the Scene is Label.
Could anyone tell me what has happend?
PS:my env :
Python2.7 cocos2d 0.5.0 pyglet 1.1.4
Windows7
| false | 8,264,192 | 0.197375 | 0 | 0 | 1 |
I try to rollback the graphics driver to the old version, the issue is resolved.
| 0 | 172 | 0 | 1 |
2011-11-25T02:08:00.000
|
windows-7,python-2.7,cocos2d-python
|
The Sprites and ColorLayers in cocos2d-python doesn't work
| 0 | 1 | 1 | 9,655,468 | 1 |
0 | 0 |
Is there any way that I can build an interactive text console using wxPython window application? It will be used to allow user to provide natural language input for the application to parse the grammar based on the language selected. It is not going to be used to run any shell or commands.
| true | 8,280,667 | 1.2 | 0 | 0 | 0 |
You can use a wx.TextCtrl for input and then when the user is done typing, you can have them press a button to do whatever checking you want done. Alternatively, you could use a wx.Timer to watch for idleness so when the user is idle for x seconds, it does the checking you want automatically too.
| 1 | 194 | 0 | 0 |
2011-11-26T18:39:00.000
|
python,user-interface,console,wxpython
|
Specialized Text Console in wxPython
| 0 | 1 | 1 | 8,298,887 | 1 |
0 | 0 |
I wrote a wxPython GUI where I currently configure some of the widgets and some default values by using "import data" for a module file containing several lists.
But I need to compile the whole program using py2exe for a user without a python installation.
In so doing, I lose the capability of letting the user edit the data.py file to change
those configuration defaults.
I could put each list as a series of text strings and read and parse the whole thing, but that
seems like a huge waste when python already can do all that by a simple import statement.
I could probably do it with xrc/xml or perhaps ConfigParser but it would seem there should be an easy way to sort of
import data.txt
or something similar and let python do it's thing! Then when py2exe gets hold of it it, it wouldn't create un-editable byte-code for the data.txt file.
Any suggestions?
| false | 8,281,067 | 0 | 0 | 0 | 0 |
files that are imported are bundled in the executable by py2exe. The way to go is to use a configuration file that you package with your executable in a zip or with Inno Setup. Configuration files are files made to be changed at some moment, contrarily a user should not be modifying a python script. I tell you because some 'negative' experiences to say something polite.
For my programs (practically all use wxPython GUIs) I use to have a py module with configuration data (directories, etc) and some globals. This module is used to load default parameters if the program does not find my .ini file or if that especific parameter has not been set in the ini. Then I distribute everything (exe and auxiliary files) with inno setup.
| 1 | 290 | 0 | 1 |
2011-11-26T19:41:00.000
|
python,py2exe
|
How to retain an "import" capability after py2exe compile
| 0 | 1 | 1 | 8,281,140 | 1 |
0 | 0 |
I want my Python program to be AppleScript-able, just like an Objective C program would be. Is that possible?
(Note, this is not about running AppleScript from Python programs, nor about calling Python programs from AppleScript via Unix program invocation. Those are straightforward. I need genuine AppleScriptability of my program's operations.)
There is some documentation about how to do this. Python 2.7.2 documentation describes MiniAEFrame, for example, but even a minimal reference to from MiniAEFrame import AEServer, MiniApplication dies with an ImportError and a complaint that a suitable image can't be found / my architecture (x86) not supported. Rut roh! It seems that MiniAEFrame might pertain to the earlier ("Carbon") API set. In other words, obsolete.
There's a very nice article about "Using PyObjC for Developing Cocoa Applications with Python"
(http://developer.apple.com/cocoa/pyobjc.html). Except it was written in 2005; my recently-updated version of Xcode (4.1) doesn't have any of the options it describes; the Xcode project files it provides blow up in an impressive build failure; and the last PyObjC update appears to have been made 2 years ago. Apple seems to have removed all of the functions that let you build "real" apps in AppleScript or Python, leaving only Objective C.
So, what are my options? Is it still possible to build a real, AppleScriptable Mac app using Python? If so, how?
(If it matters, what I need AppleScripted is text insertion. I need Dragon Dicate to be able to add text to my app. I'm currently using Tk as its UI framework, but would be happy to use the native Cocoa/Xcode APIs/tools instead, if that would help.)
| false | 8,282,352 | 0 | 0 | 0 | 0 |
You can also use the py-aemreceive module from py-appscript. I use that to implement AppleScript support in my Tkinter app.
| 1 | 206 | 1 | 5 |
2011-11-26T23:13:00.000
|
python,xcode,applescript
|
Can a program written in Python be AppleScripted?
| 0 | 1 | 2 | 13,686,960 | 1 |
0 | 0 |
I need to create a GUI in Python for a client server interaction. The GUI is on the client side for which I want to create complex tables. I tried to use wxPython's grid class, but its too tough to create a complex table in that. I saw a couple of examples for simple table layouts.
I tried to put up a snapshot of the complex table layout but the site doesn't allow me to. So, I am just drawing a format here :
[ Blah Blah Heading ]
--------------------------
[col1] | [col 2] | [col 3]
--------------------------
| | | | | |
| | | | | |
| | | | | |
Can someone please help regarding how to draw the complex layout and which module to use?
| true | 8,290,781 | 1.2 | 0 | 0 | 0 |
Tkinter would be enough for this.
You can create any level of complexity on the layout even with the "grid"
layout manager, which allows you to specify "columnspam" and "rowspam" for widgets that
will take more than a single cell.
| 0 | 903 | 0 | 1 |
2011-11-28T02:03:00.000
|
python,user-interface,tablelayout
|
Draw complex table layout in Python GUI
| 0 | 1 | 1 | 8,295,831 | 1 |
0 | 0 |
I am using pygame to write a program and I need some GUI configuration text field and button for control. I've already made the button using pygame, but I just can write a text field out of pygame. Maybe I need to use tkinter together with pygame.
I think if there is no way to made to pygame part and tkinter part together in 1 window, then I could put them into 2 separate windows.
I hope the tkinter part can update the global variable in my pygame part, would there if any problem? I might create a child process of tkinter from the pygame part so that the tkinter part can probably "see" the global variable in pygame part and modify them.
Can I do this? Are there any pitfalls?
| false | 8,291,274 | 0.066568 | 0 | 0 | 1 |
I have also found pgu is awful. However, what you say about the tkinter event loop taking control is wrong. You just call root.update instead of mainloop, and this can go inside of a while loop to replace the mainloop. Answering your main question however, there is something you should be aware of. It seems that whenever I run the two programs alongside each other, this traceback occurs:
TclError: expected boolean value but got "-1"
Fatal Python error: (pygame parachute) Segmentation Fault
This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.
Because of this I would avoid the combination, although I suspect this particular issue may pertain to my use of threads.
| 0 | 6,571 | 0 | 8 |
2011-11-28T03:39:00.000
|
python,tkinter,pygame
|
Is there anything I need aware of using Tkinter and pygame together?
| 0 | 1 | 3 | 23,665,352 | 1 |
0 | 0 |
I'm trying to create a Python implementation of Dawkins' biomorphs as described in his book, The Blind Watchmaker.
It works like this: A parent organism is displayed, as well as its offspring which are just mutated versions of the parent. Then the user clicks on a descendant it wants to breed, and all the offspring will "evolve" based on cumulative selection.
What I'm unsure of is how to get started in Python. I've already created genetic algorithm and l-system programs that are supposed to be used. The l-system program evolves trees given certain parameters (which is my goal in this biomorph implementation), and the genetic algorithm program evolves the genotypes that are created in the l-system program.
What library would be good to use (turtle, pygame, etc)?
I am familiar with turtle, but the documentation says, "To use multiple turtles an a screen one has to use the object-oriented interface." I'm not sure what that means. The reason I thought of using multiple turtles on a screen is to have the the parent and its descendants displayed on one screen, as they are in online apps. Then the user can click on the organism it wants to breed by using mouse events. Is this a good idea, or is there better way to do it?
Thanks in advance.
| true | 8,299,966 | 1.2 | 0 | 0 | 1 |
Depending on graphical requirements, I would say that for a lightweight app you could get away with PyQt or PyGame. For more demanding real-time graphical requirements you could use something like PyOgre or PyOpenGL.
You may need to also research graph-layout/data-visualisation algorithms or libraries (e.g. dot) depending on your UI goals.
| 1 | 718 | 0 | 3 |
2011-11-28T17:40:00.000
|
python
|
Biomorph Implementation in Python
| 0 | 1 | 1 | 8,425,387 | 1 |
0 | 0 |
I have a project that has code which will communicate with a python script and call python functions. In the proj file, i've added the includePath for the python header files, and added external python library to the project (python27.a). However the qt compiler gave me an error:
No rule to make target
/home/pgeng/work/OpenModelica-rev.9876.CSA/OMEdit/OMEditGUI/../../../../../../usr/lib/python2.7/libpython2.a
, needed by ../bin/OMEdit. Stop
What does this mean? How can i fix it? this is anything related to PyQt?
| true | 8,313,051 | 1.2 | 0 | 0 | 1 |
It seems like libpython2 is missing.
You will have to :
Find out what package provides this library.
You can Google for that.
Or search a repo for the lib.
| 0 | 107 | 0 | 0 |
2011-11-29T15:07:00.000
|
python,qt,dll,pyqt
|
Error on connecting to python libraries
| 0 | 1 | 1 | 8,314,327 | 1 |
0 | 0 |
I have a python program that implements pygtk for GUI. I have it running successfully on some MAC computers running os 10.6.*, after installing pygtk with macports. I have just installed pygtk on a mac 10.5.8 system. When I execute the program I get these errors:
Xlib: extension "RANDR" missing on display "/tmp/launch-CQ7og4/:0".
and
ADP_2.1.py: Fatal IO error 35 (Resource temporarily unavailable) on X server /tmp/launch-CQ7og4/:0.
After this second error the program does not continue. I looked at the /tmp/launch-CQ7og4/ directory and there is only ":0" in there.
On the other Macs that run this program the first Xlib warning always appears but the program still runs seemingly correctly.
Any help would be greatly appreciated.
| true | 8,342,215 | 1.2 | 0 | 0 | 1 |
You need to install X11-2.6.*
| 0 | 674 | 0 | 0 |
2011-12-01T13:35:00.000
|
python,pygtk,x11,osx-leopard
|
X11 errors with pygtk on Mac OS X 10.5.8
| 0 | 1 | 1 | 9,190,899 | 1 |
0 | 0 |
I have written a program in Python that generates a 10,000 tile coordinate plane with each tile having characteristics such as texture, temperature, elevation etc. I am doing this for a project and thought a much better way to show this part of the project would be to show a 3d rendering of it and the best program i know for that is Blender. I know scripts can be written in Python for Blender but I'm not sure how blender can generate things based off of a text file that my Python program writes to. If anyone knows if and how Blender can generate things from a text file or any other way i could have my Python program write to Blender would be excellent!
~ Thanks
| true | 8,350,067 | 1.2 | 0 | 0 | 1 |
You will have to make a Python script for that - that would read your text file and use blender API internally to create the tiles and the scene. Blender can only render files if it does have programs (plug-ins) that do that. Actually most file-formats can be read by blender just due to plug-ins implemented in Python that are shipped with the program.
Alternatively, you can adapt your program that generates the scene to be able to, beyond generating the text file, to draw it inside blender using its API instead. This approach might be easier than writing a separate logic to parse your own file.
If your script is Python2.x you will have to use blender 2.49 - as Blender 2.5 and newer versions use Python 3 for scripting.
| 0 | 1,046 | 0 | 4 |
2011-12-01T23:55:00.000
|
python,blender,render-to-texture
|
Can Blender generate a scene based off of a text file?
| 0 | 1 | 1 | 8,431,966 | 1 |
0 | 0 |
I am using py2exe to make executable.
I want to know how to pause the program until a button is pressed.. just like we do in C using system("pause");
As the program terminates automatically in windows, I need this tool.
Is there anything better than py2exe which does similar work ?
| false | 8,370,135 | -0.132549 | 0 | 0 | -2 |
import os
Then in your code
os.system("pause")
| 0 | 21,409 | 0 | 2 |
2011-12-03T18:59:00.000
|
python,py2exe
|
how to pause a program until a button is pressed
| 0 | 1 | 3 | 23,424,057 | 1 |
0 | 0 |
Pygame and Pyglet are for 2D game development.
Pysoy needs many requirements to be installed.
I can't figure out how to install Pyogre.
Panda3d is giving me this error and don't know how to fix it.
importerror no module named direct.showbase.showbase
Is there any other good 3D game development library that could be installed on Windows XP with Python 2.7? I prefer to install it using pypm or pypi to avoid possible errors that I'm currently having with Panda3d.
| true | 8,370,951 | 1.2 | 0 | 0 | 0 |
You can use pyopengl.
i think you might have to install pygame...
| 0 | 2,006 | 0 | 0 |
2011-12-03T20:57:00.000
|
python,3d
|
What is the best Python library for 3D game development?
| 0 | 1 | 1 | 8,874,392 | 1 |
0 | 0 |
I intend to write a networking application with a GUI frontend, presumably using GTK.
I'm completely new to GTK (and GUI programming in general). My current guess would be to use two threads, one that handles networking and the other one running the GTK frontend.
Is this the common design pattern for this kind of problem or are there better alternatives, e.g. handling networking from within the GTK main loop?
If I have to resort to using two threads, what's the best way to tell the GTK thread that there's data available from the networking thread?
| false | 8,371,453 | 0.099668 | 0 | 0 | 1 |
First thing to read up on in GUI programming is the Model View Controller pattern. You want to separate the data flow from the GUI as much as possible. The networking code updates the data model. When the data model has changed, it signals the front end so the GUI can redraw.
| 0 | 762 | 0 | 2 |
2011-12-03T22:13:00.000
|
python,c,gtk,pygtk
|
GTK networking app: need design pattern
| 0 | 1 | 2 | 8,371,633 | 1 |
0 | 1 |
I'm using QItemSelectionModel with QTableView to allow the users to select rows. The problem is that when the user then clicks on a column header to sort the rows, the selection disappears and all the sorted data is displayed. How can I keep the selection, and just sort that, rather than having all the rows appear?
Thanks!
--Erin
| true | 8,388,659 | 1.2 | 0 | 0 | 0 |
Here is the way I ended up solving this problem:
When row selections are made, put the unique IDs of each hidden row into a list, then hide all hidden rows
Use self.connect(self.myHorizontalHeader, SIGNAL("sectionClicked(int)"), self.keepSelectionValues) to catch the
event when a user clicks on a column header to sort the rows
In self.keepSelectionValue, go through each row and if the unique ID is in the hidden row list, hide the row
This effectively sorts and displays the non-hidden rows without displaying all the rows of the entire table.
| 0 | 623 | 0 | 0 |
2011-12-05T16:41:00.000
|
python,pyqt
|
How can I keep row selections in QItemSelectionModel when columns are sorted?
| 0 | 1 | 1 | 8,539,266 | 1 |
0 | 0 |
I've read that in CPython, the interpreter stack (the list of Python functions called to reach this point) is mixed with the C stack (the list of C functions that were called in the interpreter's own code). If so, then how are generators and coroutines implemented? How do they remember their execution state? Does CPython copy each generator's / coroutine's stack to and from an OS stack? Or does CPython simply keep the generator's topmost stack frame on the heap, since the generator can only yield from that topmost frame?
| true | 8,389,812 | 1.2 | 0 | 0 | 21 |
The yield instruction takes the current executing context as a closure, and transforms it into an own living object. This object has a __iter__ method which will continue after this yield statement.
So the call stack gets transformed into a heap object.
| 1 | 6,580 | 0 | 58 |
2011-12-05T18:10:00.000
|
python,coroutine
|
How are generators and coroutines implemented in CPython?
| 0 | 2 | 2 | 8,390,077 | 1 |
0 | 0 |
I've read that in CPython, the interpreter stack (the list of Python functions called to reach this point) is mixed with the C stack (the list of C functions that were called in the interpreter's own code). If so, then how are generators and coroutines implemented? How do they remember their execution state? Does CPython copy each generator's / coroutine's stack to and from an OS stack? Or does CPython simply keep the generator's topmost stack frame on the heap, since the generator can only yield from that topmost frame?
| false | 8,389,812 | 1 | 0 | 0 | 54 |
The notion that Python's stack and C stack in a running Python program are intermixed can be misleading.
The Python stack is something completely separated than the actual C stack used by the interpreter. The data structures on Python stack are actually full Python "frame" objects (that can even be introspected and have some attributes changed at run time). This stack is managed by the Python virtual machine, which itself runs in C and thus have a normal C program, machine level, stack.
When using generators and iterators, the interpreter simply stores the respective frame object somewhere else than on the Python program stack, and pushes it back there when execution of the generator resumes. This "somewhere else" is the generator object itself.Calling the method "next" or "send" on the generator object causes this to happen.
| 1 | 6,580 | 0 | 58 |
2011-12-05T18:10:00.000
|
python,coroutine
|
How are generators and coroutines implemented in CPython?
| 0 | 2 | 2 | 8,391,403 | 1 |
0 | 0 |
I have been using REALbasic for a number of years to develop cross-platform apps. I have become frustrated developing with a proprietary language and so have decided to change languages and have settled on Python and QT.
Since I know no Python, would people recommend Python 2 or 3?
I think I will be using PyQt or PySide. I know that of these two, only PyQt (currently) supports Python 3. Does this give enough of an advantage over PySide? It's just that PySide seems to have a 'cleaner' syntax.
| false | 8,396,569 | 0.066568 | 0 | 0 | 1 |
PySide and PyQt4 are almost identical. In fact, you can often replace PyQt4 with PySide (and vice versa) in your code's import declarations.
Python2 and Python3 are almost identical as well, with a few minor changes that a beginner won't notice for a while (aside from print being made a function).
Python2 has more support in terms of modules (Python3 broke backwards-compatibility with Python2), so I'd suggest you use Python2 until you figure out a reason to switch to Python3. There really is no benefit, as both releases are maintained separately.
In short, stick with the stuff that's known to work.
| 0 | 567 | 0 | 0 |
2011-12-06T07:26:00.000
|
python,qt,user-interface,pyqt,pyside
|
Best setup to develop cross-platform GUI-based apps using Python
| 0 | 1 | 3 | 8,396,619 | 1 |
1 | 0 |
Background:
I am writing an ebook editing program in python. Currently it utilizes a source-code view for editing, and I would like to port it over to a wysiwyg view for editing. The best (only?) html renderer I could find for python was webkit (I am using the PyQt version).
Question:
How do I accomplish wysiwyg editing? The requirements/issues are as follows:
An ebook may be up to 10,000 paragraphs / 1,000,000
characters.
PyQt Webkit (ContentEditable): No problem.
PyQt Webkit (TinyMce, etc): Takes forever to open them!
The format is <body><p>...</p><p>...</p>...</body>. The body element contains only paragraphs, there are no divs, etc (but in the paragraph there may be spans, links, etc.). Editing must take place with no significant delays as far as the user is concerned.
PyQt Webkit (ContentEditable): If you try deleting text across multiple paragraphs, it takes forever!! My understanding is that this is because it resets the common-parent of the elements being changed - i.e. the entire body element, since two different paragraphs are being deleted/merged. But, there should be no need for this - it should need only delete/merge/change those individual paragraphs!
I am open to implementing my own wysiwyg editing, but for the life of me I can't figure out how to delete/cut/paste/merge/change the html code correctly. I searched online for articles about html wysiwyg design theory, and came up dry.
Thanks!
| false | 8,412,215 | 0.197375 | 1 | 0 | 1 |
Can i suggest a complete another approach ? Since your ebook is only <p></p>:
Split the text on <p></p> to get an indexed array of all your paragraphs
Make your own pagination system, and fill the screen with N paragraphs, that automatically get enough text to show from the indexed array
When you are doing selection, you can use [paragraph index + character index in the paragraph] for selection start / end
Then implement cut/copy/paste/delete/undo/redo based on thoses assumptions.
(Note: when you'll do a selection, since the start point is saved, you can safely change the text on the screen / pagination, until the selection end.)
| 0 | 1,587 | 0 | 2 |
2011-12-07T08:17:00.000
|
python,html,wysiwyg
|
Python/Javascript: WYSIWYG html editor - Handle large documents fast and/or design theory
| 0 | 1 | 1 | 8,413,073 | 1 |
0 | 0 |
In CPython, I think, import means compile the py file to a pyc file and execute the file in the current frame, and the next time CPython will load the pyc file directly without compiling again. What about import in ironpython? I guess ironpython don't have a pyc-like format. Does it compile every time when import?
| true | 8,426,999 | 1.2 | 0 | 0 | 7 |
Yes, IronPython recompiles the imported module on every run. Twice, actually.
It's complicated.
On the first pass, the Python code is parsed into an AST, the AST is converted into a DLR expression tree, and the expression tree is stored. When it is time to execute it, the expression tree is compiled into a set of instructions for a simple stack-based interpreter and the module code is executed on that interpreter. It's not fast when running, but it has very little start up time.
After a piece of code has run for a while, IronPython gets fed up with how slow it is, goes back to the expression tree, and recompiles the code into a .NET delegate. This means that it gets converted to MSIL and then native code by the .NET JIT. This code is fast to execute, but takes time to create.
This conversion is done a per-function (or even per-loop) basis, so that if you use one function from a module repeatedly and none of the rest, only the one commonly-used function will undergo full IL code generation and JITting.
None of this compilation is saved to disk, however. The pyc.py program included with IronPython can precompile the code, but it's not done automatically because the code generated at runtime is different than the code generated by pyc.py. The runtime code is usually collectible, while the code generated by pyc.py is not - and generating non-collectible code at runtime leads to memory leaks. pyc.py should make imports faster by saving a few steps, but I'm not sure by how much.
| 1 | 499 | 0 | 6 |
2011-12-08T06:19:00.000
|
python,import,ironpython,dynamic-language-runtime
|
What happens when import a module in ironpython?
| 0 | 1 | 1 | 8,434,676 | 1 |
0 | 0 |
I'm working on a project that contains a QTreeWidget. This widget will have Parent nodes with childs nodes and or other siblings nodes. Attached to each node will be a unique ID in the form of an integer as well as a name.
Now..... what methods can or should I use to save all the nodes in the QTreeWidget to disk and how to read them back in?????
What I would do is traverse the tree and save each node into a sqlite DB. I already can do that in exactly the same order as it is in the tree. BUT...... QTreeWidget and its related QTreeWidgetItem objects do NOT have a uniq index that you can USE to insert other nodes around.
When I rebuild the tree, childs have to be attached to their parents/ancestor (which by then exists in the tree). To do so I keep track of the Parents and their IDs I already added to the tree, like (parent name, parentID) inside an array. Note that the parentID has nothing to do with location as a node inside the QTreeWidget/WidgetItem. It is created by myself and stored insite the sqlite db allong with the name of the node just as some sort of tag since QTreeWidget/QTreeWidgetItem does not supply any.
To determine the correct parent I
take the ParentID from the sqlite DB,
search the array or the QTreeWidget for that same ID,
select that parent in the QTreeWidget,
add the sqlite db item as a child node to the parent in the
treeview.
But it feels clumsy this way, because of the search each time a node is added and because of a missing index inside the QTreeWidget/WidgetItem I can use for inserting nodes around.
I know this should be done much more elegant and less resource intensive.
I'm not looking for exact coding examples but more for ideas and hints of the methods and properties to use from QTreeWidget and QTreeWidgetItem.
Any ideas?
| false | 8,432,620 | 0 | 0 | 0 | 0 |
I managed this by using the data property of the TreewidgetItem by setting a value in it. Using that value as a reference to find one or more or even all TreewidgetItem(s) makes it easy to save a complete tree.
| 0 | 2,266 | 0 | 2 |
2011-12-08T14:35:00.000
|
python,sqlite,pyqt,qtreewidget,qtreewidgetitem
|
QTreeWidget and PyQt: Methods to save and read data back in from file
| 0 | 1 | 2 | 14,873,799 | 1 |
0 | 0 |
Can I execute Python on Windows Phone? I have heard about IronPython but is it the way to go when I need to compile to a lot of existing Python code for Windows Mobile?
| true | 8,436,112 | 1.2 | 0 | 0 | 2 |
Only (some) mananged .net languages are supported on Windows Phone (note. this is not the same as Windows Mobile).
IronPython is the only option available to you when it comes to executing python code on the phone.
| 0 | 967 | 0 | 0 |
2011-12-08T18:54:00.000
|
.net,python,windows-phone-7
|
Python on Windows Phone?
| 0 | 1 | 1 | 8,436,266 | 1 |
0 | 0 |
I am a beginner in python. For practice reasons I want to learn how to upload a python code to a website.
I have a domain and web hosting service, however I'm really confused about how to integrate my code with a
web page on my website.
(I have a decent bit of knowledge with Tkinter)
Can anybody show me how to upload this simple function to my website?:
There are two entries on the interface for the user to enter two numbers. On pressing a button a new
window(web page) with the answer displayed.
Thank you.
| false | 8,453,362 | 0 | 0 | 0 | 0 |
I would recommend you look at something like Django and mod_wsgi.
Generally helps if you have shell access to the server.
| 0 | 3,068 | 0 | 0 |
2011-12-10T00:25:00.000
|
python,interface,upload,web
|
Simple python code to website
| 0 | 1 | 2 | 8,453,549 | 1 |
0 | 0 |
How can I build a range slider from which I can get the range of two values, e.g., min and max? The scale widget seems not meet this requirement. I can only get one value from it and I don't want to use two scale to do this.
Thanks
| false | 8,453,871 | 0.197375 | 0 | 0 | 2 |
You could create one by drawing the individual parts of the widget on a canvas. It's pretty easy to add bindings for dragging things around.
| 0 | 1,222 | 0 | 3 |
2011-12-10T02:08:00.000
|
python,tkinter
|
How to build a range slider using tkinter?
| 0 | 1 | 2 | 8,458,598 | 1 |
0 | 0 |
I'm building simple PyGTK app with Glade.
In one dialog I have table layout with labels in first column, and text entries in second column.
The problem is that two columns have always same width, and I want 2nd column to be wider then the first one.
How can I achieve that?
| true | 8,455,516 | 1.2 | 0 | 0 | 2 |
If you use a gtk.Table to display your widgets in your dialog. You can set the homogeneous property to False, so that cells in the table don't have the same dimensions.
After that, if the largest widget in the second column is wider than the largest widget in the first column (which I assume is your case), then the secound column will be wider than the first column as you need.
| 0 | 1,466 | 0 | 2 |
2011-12-10T09:11:00.000
|
python,pygtk,glade
|
Setting separate GtkTable column width
| 0 | 1 | 1 | 8,456,076 | 1 |
0 | 0 |
The FileDialog in pyqt is an excellent way to get one path for a file from the user, but is there a good way to get a large number of file selections from the user?
| false | 8,498,475 | 0 | 0 | 0 | 0 |
I would suggest you to let the user use drag & drop to add files directly from their favorite file browser. As I did this in wxpython without any trouble and user-feedbacks are pretty good :)
| 0 | 5,368 | 0 | 1 |
2011-12-14T01:17:00.000
|
python,pyqt,pyqt4,qfiledialog
|
PyQt: How can I get a large list of filenames from the user?
| 0 | 1 | 2 | 8,498,496 | 1 |
0 | 0 |
What is the fastest or most efficient way of maintaining some sort of array for pixels on a screen in Python ? I don't want to use game libraries, just a simple array as I already have parts of it done without any libraries.
I'm developing a program which moving random stuff around the screen and i need to know whether a portion of the screen is already being used. what do you think ?
Should i be maintaining an entire array for the whole screen with 0s and 1s for on and off ?
or perhaps just a list of 'currently used pixels' ?
or could i use sets for this ? as they don’t seem to store something twice.
not sure if you could somehow try and store a new pixel in it and use the failure as a result of that pixel is already used.
or.. perhaps you have another idea that is better than what I've thought of so far.
Thanks!
| false | 8,513,821 | 0 | 0 | 0 | 0 |
Since you're going to be bouncing off these boundaries, use a range of values to indicate the angle of the surface rather than just 0 or 1. Keep the array the same way you're storing the image pixels.
| 1 | 57 | 0 | 0 |
2011-12-15T00:56:00.000
|
python,graphics
|
Speedy lookups from some kind of table (for graphics collisions)
| 0 | 1 | 1 | 8,513,902 | 1 |
0 | 0 |
I am using the pyglet (OpenGL) library and I want to be able to change the virtual resolution without changing the size of the window. For example a 2x2 box would be drawn as 4x4 pixels on the screen. I know I can find everything that is being draw and scale it individually, but this would probably be costly.
I could not find a solution for this online (if it even exists), so any help would be greatly appreciated.
Clarification: I am thinking along the lines of the resolution settings in most games. The window stays in full screen at the same size, but the scale changes.
| false | 8,556,589 | 0.197375 | 0 | 0 | 2 |
Clarification: I am thinking along the lines of the resolution settings in most games. The window stays in full screen at the same size, but the scale changes.
No, the window does change the size, because the screen resolution is changed, and the window follows.
However what you intend to do it perfectly possible: First render your image to a FBO of the desired smaller size, then render the contents of that FBO covering the full window. In the case a 3D engine uses some form of post processing (like for depth of field, color grading, compositing effects), this comes virtually for free.
| 0 | 2,504 | 0 | 2 |
2011-12-19T02:39:00.000
|
python,opengl,scale,resolution,pyglet
|
Scale Resolution in Pyglet
| 0 | 1 | 2 | 8,559,413 | 1 |
0 | 0 |
I am using wxpython and I would like to get all the elements in the listbox and returned in a list.
(Almost like the Oposite of the "Set" function)
Example:
Listbox has
Dog
Cat
Fun
The function should return ["Dog","Cat","Fun"]
Thanks
| true | 8,556,752 | 1.2 | 0 | 0 | 1 |
.GetItems()
This function can get all elements in your Listbox as a list.
| 1 | 603 | 0 | 2 |
2011-12-19T03:13:00.000
|
wxpython,wxwidgets
|
How to get listbox elements in a list? wxpython
| 0 | 1 | 2 | 8,556,812 | 1 |
0 | 0 |
I have .ui, .py and .pyc files generated. Now, when I edit the .py file, how will it reflect changes in the .ui file? How do I connect .the ui and .py files together as QT designer allows only .ui files for running purposes?
| false | 8,571,366 | 0 | 0 | 0 | 0 |
the .py file generated from pyuic is not supposed to be edited by the user, best way it is intended to use is to subclass the class in .py file into your own class and do the necessary changes in your class..
| 0 | 227 | 0 | 0 |
2011-12-20T05:57:00.000
|
python,pyqt
|
Running .py files
| 0 | 1 | 2 | 8,571,839 | 1 |
0 | 0 |
I wanted to recompile PIL after having installed libjpeg because it threw the decoder jpeg not available whenever I tried importing JPEG images.
So, I've downloaded libjpeg, compiled it and installed it. Then I removed the ./build folder from PIL's source cache, and recompiled it (using sudo python setup.py install).
Now the selftest.py thing is failing with *** The _imaging C module is not installed. I have no idea what the issue is.
There are no symbol errors.
The _imaging module is importable
All dylibs are loaded properly (according to -v)
The decoder error is still there.
Does anyone know what could be causing this? I'm on OS X Lion.
| true | 8,590,714 | 1.2 | 1 | 0 | 1 |
What would I try:
Remove old PIL and install new it from scratch (maybe it did not override properly).
If you missed something when compiling the libjpeg, like path specifications it will not find some of the libraries, so I recomend trying MacPorts py27-pil port for PIL installation, which will place all dependancies.
| 1 | 672 | 0 | 0 |
2011-12-21T13:41:00.000
|
python,python-imaging-library
|
Can't get PIL to work on Mac OS X
| 0 | 1 | 2 | 8,591,901 | 1 |
0 | 0 |
I am writing a python application using tkinter. One of my classes only uses the delete method on an Entry widget object. I wanted to know if there was a way to only import that method instead of importing the entire package.
I have tried looking around online and have tried different things, but I have not had much luck as of yet.
I am finding the online documentation for the standard python libraries to be very unclear and confusing.
| true | 8,597,543 | 1.2 | 0 | 0 | 2 |
No, there is no way to import only one method of a widget, or only one method of any class. When you import a class you get the whole class.
Why do you think it would be advantageous to import only one method? If you're concerned about memory consumption, don't be.
| 1 | 106 | 0 | 0 |
2011-12-21T23:02:00.000
|
python,import,tkinter
|
How to import only one Tkinter widget method instead of a whole package?
| 0 | 1 | 1 | 8,598,161 | 1 |
0 | 0 |
I am writing an Onscreen Keyboard in python, with clutter. I've gotten the ClutterStage's XWindow object, but I can't find any properties which prevent the window from stealing focus. Basically, it needs to accept mouse events (click, motion, etc), while not stealing keyboard focus from the window it is trying to type in. Any ideas? :)
| false | 8,611,290 | 0 | 0 | 0 | 0 |
by the way input delivery works on X11, this cannot happen: an X11 window has to have focus in order to receive input events - in other words: events are delivered only to the focused window.
the input method and accessibility support in GTK+, for instance, relies on the toolkit sending and receiving data to and from another process, through a specific API (IM and ATK, respectively). all virtual keyboard in GNOME use either methods to handle input events.
on pure X11 you could use the XTest extension API to send events from the virtual keyboard to the application that invoked it.
| 0 | 1,660 | 0 | 1 |
2011-12-23T01:09:00.000
|
python,x11,xlib,clutter
|
What XWindow property can prevent a window from getting focus, while letting it receive mouse events?
| 0 | 1 | 2 | 8,623,734 | 1 |
0 | 0 |
I want to learn about graphical libraries by myself and toy with them a bit. I built a small program that defines lines and shapes as lists of pixels, but I cannot find a way to access the screen directly so that I can display the points on the screen without any intermediate.
What I mean is that I do not want to use any prebuilt graphical library such as gnome, cocoa, etc. I usually use Python to code and my program uses Python, but I can also code and integrate C modules with it.
I am aware that accessing the screen hardware directly takes away the multiplatform side of Python, but I disregard it for the sake of learning. So: is there any way to access the hardware directly in Python, and if so, what is it?
| false | 8,622,667 | 0.066568 | 0 | 0 | 1 |
This is rather an old thread now, but I stumbled upon it while musing the same question.
I used to program in assembly language. In my day, drawing on screen was simply(?) a matter of poking a value into a memory location. The value turned a pixel on or off and defined its colour.
The term 'poke' comes from Basic by the way, not assembler. In assembler, you had to write a value into a data register then tell the processor where to put the data using another command and specifying an address register, usually in hexadecimal form! And each different processor had its own assembly language. But hec was the code fast!
As hardware progressed, I found that graphics hardware programming became more and more complex. There's much more to it than now simply defining a pixel. The graphics subsystem has its own processor -- or processors -- and it's that that you've got to learn to talk to. The processor doesn't just plonk stuff in memory locations. (I believe that what used to be the fastest supercomputer in the world for a while ran on graphics chips!) 'Plonk' is not a Basic command by the way.
Sorry; I digress. In answer to the original poster's query, I believe that the goal of understanding the graphics-drawing process could have been best achieved by experimenting with a Raspberry Pi. It's Python compatible and hence perfect for the job. Its hardware is well documented and it's cheap and easy to use.
Hope this helps someone, Cheers, M
| 0 | 4,998 | 0 | 11 |
2011-12-24T00:32:00.000
|
python,hardware,graphics
|
Is there a way to access hardware directly in Python?
| 0 | 2 | 3 | 18,431,135 | 1 |
0 | 0 |
I want to learn about graphical libraries by myself and toy with them a bit. I built a small program that defines lines and shapes as lists of pixels, but I cannot find a way to access the screen directly so that I can display the points on the screen without any intermediate.
What I mean is that I do not want to use any prebuilt graphical library such as gnome, cocoa, etc. I usually use Python to code and my program uses Python, but I can also code and integrate C modules with it.
I am aware that accessing the screen hardware directly takes away the multiplatform side of Python, but I disregard it for the sake of learning. So: is there any way to access the hardware directly in Python, and if so, what is it?
| false | 8,622,667 | 1 | 0 | 0 | 7 |
No, Python isn't the best choice for this type of raw hardware access to the video card. I would recommend writing C in DOS. Well, actually, I don't recommend it. It's a horrible thing to do. But, it's how I learned to do it, and it's probably about as friendly as you are going to get for accessing hardware directly without any intermediate.
I say DOS rather than Linux or NT because neither of those will give you direct access to the video hardware without writing a driver. That means having to learn the whole driver API, and you need to invoke a lot of "magic," that won't be very obvious because writing a video driver in Windows NT is fairly complicated.
I say C rather than Python because it gives you real pointers, and the ability to do stupid things with them. Under DOS, you can write to arbitrary physical memory addresses in C, which seems to be what you want. Trying to get Python working at all under an OS terrible enough to allow you direct hardware access would be a frustration in itself, even if you only wanted to do simple stuff that Python is good at.
And, as others have said, don't expect to use anything that you learn with this project in the real world. It may be interesting, but if you tried to write a real application in this way, you'd promptly be shot by whoever would have to maintain your code.
| 0 | 4,998 | 0 | 11 |
2011-12-24T00:32:00.000
|
python,hardware,graphics
|
Is there a way to access hardware directly in Python?
| 0 | 2 | 3 | 8,622,706 | 1 |
0 | 0 |
I installed cocos2d today on OS X Lion, but whenever I try to import cocos in the Python interpreter, I get a bunch of import errors.
File "", line 1, in File
"/Library/Frameworks/Python.framework/Versions/2.7/lib/
python2.7/site-packages/cocos2d-0.5.0-py2.7.egg/cocos/init.py",
line 105, in
import_all() File "/Library/Frameworks/Python.framework/Versions/2.7/lib/
python2.7/site-packages/cocos2d-0.5.0-py2.7.egg/cocos/init.py",
line 89, in import_all
import actions File "/Library/Frameworks/Python.framework/Versions/2.7/lib/
python2.7/site-packages/cocos2d-0.5.0-py2.7.egg/cocos/actions/
init.py", line 37, in
from basegrid_actions import * File "/Library/Frameworks/Python.framework/Versions/2.7/lib/
python2.7/site-packages/cocos2d-0.5.0-py2.7.egg/cocos/actions/
basegrid_actions.py", line 62, in
from pyglet.gl import * File "build/bdist.macosx-10.6-intel/egg/pyglet/gl/init.py", line 510,
in File
"build/bdist.macosx-10.6-intel/egg/pyglet/window/init.py", line
1669, in File
"build/bdist.macosx-10.6-intel/egg/pyglet/window/carbon/
init.py", line 69, in File "build/bdist.macosx-10.6-intel/egg/pyglet/lib.py", line 90, in
load_library File
"build/bdist.macosx-10.6-intel/egg/pyglet/lib.py", line 226, in
load_framework File
"/Library/Frameworks/Python.framework/Versions/2.7/lib/
python2.7/ctypes/init.py", line 431, in LoadLibrary
return self._dlltype(name) File "/Library/Frameworks/Python.framework/Versions/2.7/lib/
python2.7/ctypes/init.py", line 353, in init
self._handle = _dlopen(self._name, mode) OSError: dlopen(/System/Library/Frameworks/QuickTime.framework/ QuickTime, 6):
no suitable image found. Did find:
/System/Library/Frameworks/QuickTime.framework/QuickTime: mach-o, but wrong architecture
/System/Library/Frameworks/QuickTime.framework/QuickTime: mach-o, but wrong architecture
Since I can't fix it, I'd like to remove cocos2d entirely. The problem is that I can't seem to find a guide anywhere that details how to remove it from the Python installation.
Any help regarding either of these problems is greatly appreciated.
| true | 8,626,180 | 1.2 | 0 | 0 | 1 |
You could fix it.
The problem comes from the fact that cocos2D is built on top of Pyglet, and the stable release of pyglet does not yet support Mac OS X 64 bits architecture. You have to use the 1.2 release of pyglet or later, which by now is not released yet.
A workaround is to remove any existing Pyglet install:
pip uninstall piglet
Then install the latest Pyglet from the mercurial repository
pip install hg+https://pyglet.googlecode.com/hg/
| 0 | 559 | 1 | 0 |
2011-12-24T18:25:00.000
|
python,cocos2d-python
|
Removing cocos2d-python from Mac
| 0 | 1 | 1 | 10,575,373 | 1 |
0 | 0 |
in pygtk when I set the label mylabel = gtk.Label("Hello World!") I can get the string of label from it by mylabel.get() method. but in python interpreter I can't get the docstring of this method: help(gtk.Label.get). Anyone know why?
| true | 8,648,537 | 1.2 | 0 | 0 | 2 |
It might be that what you wanted to ask was answered by @DonQuestion already... however if you truly just wanted to ask why help(gtk.Label.get) doesn't return a help... the answer is actually very simple: because the get method in the Label object lacks a docstring in the source code. :)
In fact the call to help doesn't generate an error, just an empty answer.
| 0 | 149 | 0 | 0 |
2011-12-27T19:37:00.000
|
python,gtk,pygtk,docstring
|
How to get help of PyGTK methods?
| 0 | 2 | 3 | 8,648,804 | 1 |
0 | 0 |
in pygtk when I set the label mylabel = gtk.Label("Hello World!") I can get the string of label from it by mylabel.get() method. but in python interpreter I can't get the docstring of this method: help(gtk.Label.get). Anyone know why?
| false | 8,648,537 | 0.197375 | 0 | 0 | 3 |
Because the method gtk.Label.get is an object itself, and has some attributes. The builtin function help looks the __doc__ attribute and some other dictionaries of the object and the Class of the object up and returns them (formatted). You could do a help(help) for example! ;-) so help(gtk.Label.get) returns the attribute "__doc__" of the method/object gtk.Label.get and some other information gathered by class-introspection. It doesn't give you a help on the actual values of your gtk.Label instance.
| 0 | 149 | 0 | 0 |
2011-12-27T19:37:00.000
|
python,gtk,pygtk,docstring
|
How to get help of PyGTK methods?
| 0 | 2 | 3 | 8,648,722 | 1 |
0 | 0 |
I've spent hours on this. Seems like our job on Linux is to debug scripts that don't work across the fragmented distros rather than getting work done.
Setup.py tries to find what it needs and build the c modules used to wrap certain dependencies if it can find what it needs. This makes the script super fragile relative to paths and file names.
While it is VERY hard to tell from the .py source, it seems for tkinter we need tcl, tk, and tix. Latest versions of these are all installed. I can verify this because Python 2.6 that comes with the SUSE distro imports_tkinter and Tkinter modules and runs the test script correctly.
The script seems to need to find the libraries. I have both 32 bit and 64 bit installed. So, these libraries exist:
32bit 64bit
libtk8.5.so /usr/lib /usr/lib64
libtcl8.5.so " "
Both paths are included in the appropriate search list in Setup.py. But, I don't think Setup.py searches for the correct file names. It seems to search for files that begin with tk and tcl, catenating a variety of different versions (including '8.5'). But, the file names don't begin with 'lib'. Before I begin tampering more, could the Python.org folks have really messed this up so badly? That doesn't seem likely. Is SUSE Linux so odd a distro? This doesn't seem likely either.
I don't think setup.py would look for the binaries (would matter at run time it would seem...) but they are present in usr/lib and usr/lib64.
The only include file I can find is for tclextend. It is tclextend.h found in usr/include. I could not find other .h files for tcl or tk. Of course the include files that the Python c wrappers require are supplied with the download of Python 2.7.
So, I am kind of at my wit's end. This is such a colossal waste of time. Is there a way to just skip the build process and just build the tcl/tk support? I also have the same problem with ssl: it would not build. One thing at a time.
Thanks for your help.
| true | 8,650,079 | 1.2 | 0 | 0 | 0 |
I found many distribution points for sets of rpm packages. This enabled me to install individual packages such as the headers for tcl. But, this was a bad approach because the full dependency hierarchy to build Python support for tkinter is something on the order of 60 packages.
I found that the OpenSuSE repository for version 11.3 of the OS contained everything I needed. My Novell distro came with Novell's repositories which exclude nearly all devel packages.
Problem solved. The make of python found all of the prerequisites for tkinter.
Sorry to post such a nube question.
| 0 | 1,235 | 1 | 0 |
2011-12-27T22:48:00.000
|
python,build,suse
|
Python 2.7.2 install on Suse Linux Server 11.3 can't find tkinter dependencies
| 0 | 1 | 1 | 8,662,523 | 1 |
1 | 0 |
Is it possible to embed a wxPython based GUI in an HTML page?
If not, is there any other option other than Java applets to make GUIs that can be embedded onto an HTML page?
| false | 8,654,165 | 0 | 0 | 0 | 0 |
You can use Javascript to create your own GUI to show. Maybe Google's NaCl is far enough advanced but it won't give you the cross browser compatibility you'll probably like.
If you look at broadway (which is linked in one of the other answers), you'll need to run an X session for each user.
| 0 | 669 | 0 | 1 |
2011-12-28T09:37:00.000
|
python,html,wxpython
|
wxPython GUI on a web page?
| 0 | 1 | 2 | 8,654,270 | 1 |
0 | 0 |
I have an Android application that has user contributed images. There are a lot of users that submit black or really dark images to the backend application, that I want to filter out. Best solution would be to filter the images already at the phone and notify the user to make more light and retake the picture. Another solution if easier to achive would be to filter it at the backend written in python. I took a look into opencv, but I do not really have a clue where to start. Any hints where to get information to measure the brightness/color of an image in Android and/or in python ?
| false | 8,659,663 | 0 | 0 | 0 | 0 |
What about converting the image into greyscale one, calculate average color of the greyscale image, and filter out images than go over some threshold?
| 0 | 2,293 | 0 | 2 |
2011-12-28T18:19:00.000
|
android,python,image-processing
|
Detecting black images on Android or python
| 0 | 1 | 4 | 8,659,766 | 1 |
0 | 0 |
I have an NSMutableArray filled with BeziarPaths. I'd like to serialize it so that its accessible on Python. Someone suggested to me that I can try GZIP + InkML or GZIP +JSON. I was wondering what the best way to do this is. I am also really new to this, so example code would be extremely helpful.
Thanks
| true | 8,661,415 | 1.2 | 1 | 0 | 0 |
Choose what you like most. Both are standards, but JSON is a generic format used for serializing dictionaries and arrays, while InkML focuses on drawing related objects.
JSON support is available in both Python and Objective-C, while InkML has no built-in support in either.
| 0 | 318 | 0 | 1 |
2011-12-28T21:15:00.000
|
python,objective-c,serialization
|
Objective C to Python Serialization
| 0 | 1 | 2 | 8,661,467 | 1 |
0 | 0 |
I have a number of text widgets floating on a scrollable canvas widget. I want to allow users to resize them by dragging their edges and/or corners, possibly moving them if they drag the upper left edges or corner. I'm open to making them into frames with text widgets inside them, since I'm likely to do that anyway.
I figure I can handle the events manually if I can just get it to show resize handles. Do I need to catch mouseovers and clicks on a border myself?
Adding a "<Configure>" event binding does nothing, as one would expect. ttk.Sizegrip allegedly only works on top-level windows. There are lots of resources for preventing resizes, but very few for facilitating them, and they all seem to be for top-level windows.
| false | 8,735,668 | 0.099668 | 0 | 0 | 1 |
You could use the PanedWindow widget, or a combination of a few of them, inside your canvas. They are designed to do that. Getting the PanedWindow to stretch like the "sticky" command inside the canvas is an unknown though.
That is what I was looking for when stumbled across this post.
| 0 | 3,942 | 0 | 1 |
2012-01-04T23:37:00.000
|
python,tkinter
|
Make widgets/frames inside tkinter canvas resizable
| 0 | 1 | 2 | 12,025,488 | 1 |
0 | 0 |
I'm trying to use a file that uses PIL and when I try to run it I get the following error:
ImportError: The _imaging C module is not installed
I know theres a bunch of threads online about this but most of them see pretty specific. I'm 100% sure there is no problem with the code I'm running. Python version 2.7.2 64bit windows 7. I've been trying to fix it for almost an hour or so and I'm losing my mind. Any suggestions?
| false | 8,747,299 | 0.049958 | 1 | 0 | 1 |
try to install pillow. you can install it with the command: pip install pillow
you have install the python-imaging??
sudo apt-get install python-imaging. install first the python-imaging and next install the pillow
| 1 | 6,417 | 0 | 0 |
2012-01-05T17:56:00.000
|
python,module,imaging
|
Python: PIL _imaging C module
| 0 | 1 | 4 | 11,829,919 | 1 |
0 | 0 |
I would like to determine a user's wallpaper path with PyGTK.
If possible, I would like to not rely on a Desktop Environment's function to do this - this is because some users(like myself) do not use a DE. Because of this, I am wondering if you can use X11 or something else to determine the current wallpaper being used.
| true | 8,774,388 | 1.2 | 0 | 0 | 2 |
You MUST rely on a desktop environment, otherwise it is not possible, since X11 isn't supposed to handle such things as wallpapers. When you set a background image, an external program loads the image and sets it as the background pixmap of the root window. Therefore, unless the specific loading mechanism stores the image path somewhere, X11 itself will never know where the image file is located on the disk.
| 0 | 382 | 0 | 0 |
2012-01-08T00:36:00.000
|
python,pygtk,x11
|
Determining path to current wallpaper with pygtk (maybe X11?)
| 0 | 1 | 1 | 8,778,003 | 1 |
0 | 0 |
My GUI consists of a wx.ListCtrl on the left, with a list of objects to edit, and a set of wx.TextCtrls on the right, for editing the selected object.
My strategy for implementing this was:
On a textbox's wx.EVT_KILL_FOCUS , update the relevant attribute of the currently selected object
On the list's wx.EVT_LIST_ITEM_DESELECTED, either hide the textboxes or blank them out and disable them (needed for when the user clicks the blank space in the list control)
On the list's wx.EVT_LIST_ITEM_SELECTED, populate the text controls with the values of the selected object's attributes
With this setup, there are 3 use cases, and 2 of them work:
When the user is clicking/tabbing between textboxes, the correct wx.EVT_KILL_FOCUSs occur, and the attributes get updated.
When the user clicks from a textbox into the blank space in the list, that's OK as well: first wx.EVT_KILL_FOCUS causes the attribute to update, and then wx.EVT_LIST_ITEM_DESELECTED hides the textboxes.
The problem is when the user clicks directly from a textbox to another object in the list control. The order of events in this case is wx.EVT_LIST_ITEM_DESELECTED, wx.EVT_LIST_ITEM_SELECTED, and then finally wx.EVT_KILL_FOCUS. You can probably see the problem: by the time the method that updates attributes is called, a new object has already been selected and the textboxes have been populated with new values.
So I know exactly what the problem is, but I can't come up with a nice, clean way to fix it. Ideally I'd like to be able to change the order of the wx events (putting wx.EVT_KILL_FOCUS at the front), but I doubt that's possible. Is there some other obvious solution I'm missing?
| true | 8,783,236 | 1.2 | 0 | 0 | 1 |
wx.EVT_LIST_ITEM_DESELECTED will only fire when the user changes the selected object in the list box. This serves the same purpose as losing focus on the text box. Call the update routines from that event as well. To skip the subsequent wx.EVT_KILL_FOCUS from the text box set a "isDirty" attribute in the parent object after you update the attributes. You can check the isDirty value anytime to confirm there are changes to commit. This attribute would have to be reset when you populate the text boxes for the new selection and then set during other textbox events.
| 0 | 256 | 0 | 0 |
2012-01-09T02:12:00.000
|
python,wxpython,wxwidgets
|
The order of wxPython events is causing me problems
| 0 | 1 | 2 | 8,783,458 | 1 |
0 | 0 |
I am looking for a way in which wxPython GUI elements can be added into pygame. If there is an alternative to solve the purpose of adding GUI elements to a pygame please suggest so. I am having problem in installing PGU.Thanks for help.
| false | 8,798,043 | 0 | 0 | 0 | 0 |
I dont think its possible since wxPython (using wxWidgets c++) is a wrapper around the window management system, it rely on the OS functions to draw on screen (it convert to the right system calls depending on OS).
Pygame uses SDL and a simple code to window management system, it calls few OS functions just to create the window and give it to SDL to draw on it, like a canvas.
One way is:
using ctypes to make C calls into OS library files to draw system native widgets, this way you aren't using any pygame functions.
Other way(ugly and not sure if works):
I dont know how, but finding a way to convert widgets into image buffer objects and use it like surfaces(plain bitmaps).
What I think you should do:
Use pygame, build your own GUI using surfaces and mouse/keyboard events to control it or download some pre-made.
Stick with wx, you can build your GUI easily on system native theme, also you can use DC (draw contexts) to draw like pygame, and maybe (not sure) include pygame context into wx as one widget.
You can benefit from wx having its own event handler.
I hope it helps you in some way.
| 0 | 1,738 | 0 | 6 |
2012-01-10T02:57:00.000
|
user-interface,wxpython,pygame
|
Adding wxpython in pygame
| 0 | 1 | 2 | 9,446,899 | 1 |
0 | 0 |
Two part question:
I have a 10x10 QTableWidget with QTableWidgetItem in each cell.
For some reason, clicking on a cell is not sufficient to edit it, I need to double-click the cell to enter it.
Is there a way to change this behavior to single click
Is there a way to have 2nd cell in 1st row selected and ready for editing by default when window is created?
| false | 8,826,688 | 0.197375 | 0 | 0 | 2 |
You can also use setCurrentCell.
table.setCurrentCell(0,1)
QTableWidget.setCurrentCell (self, int row, int column)
| 0 | 3,799 | 0 | 2 |
2012-01-11T21:11:00.000
|
python,pyqt,pyqt4,editing,qtablewidget
|
QTableWidget how to have a cell selected for editing from code and/or with single click
| 0 | 1 | 2 | 8,948,046 | 1 |
0 | 0 |
I'm using PyQT v4.9 for Windows 7, and Visual Studio 2010 (extension PTVS 1.1 )
Autocomplete is good function in IDE. Example:
object.method_of_class() #when I press the dot, see a list of possible methods.
But with pyqt class, this not works, exapmle:
QtGui.QDesktopWidget()
How can I solve this problem?
P.S. Forgive me for my bad English
| false | 8,830,355 | 0.53705 | 0 | 0 | 3 |
I had the same problem with PTVS version 1.1.1 . I did the following . Now auto completion works for PyQT libraries.
1. upgraded the PTVS to 1.5
2. In visual studio , select tools-options- python tools-interpreter options. Click on "Generate completion" , then restart the visual studio.
| 1 | 1,633 | 0 | 1 |
2012-01-12T05:01:00.000
|
python,visual-studio-2010,pyqt,ptvs
|
PyQT and Visual Studio 2010
| 0 | 1 | 1 | 11,158,550 | 1 |
0 | 0 |
What is the use of the wx.App class (apart from what the documentation says), when you can just create a frame and .Show(True) it?
When should a wx.App class be used, or why shouldn't you create a frame and just show it?
| false | 8,835,679 | 0.132549 | 0 | 0 | 2 |
The wx.App does a bunch of behind the scenes stuff to make your application work. It does the main loop, which is what waits for the user to do something and then responds. You have to have it. As FogleBird mentioned. By the way, you should NOT have more than one. Doing so will cause weird issues, if it works at all.
| 0 | 661 | 0 | 1 |
2012-01-12T13:17:00.000
|
python,wxpython,wxwidgets
|
purpose of wx.App when just showing a frame is enough
| 0 | 1 | 3 | 8,837,486 | 1 |
0 | 0 |
I have a question about the virtual memory in Python.
When the process is consuming a relatively large amount of memory, it doesn't "release" the unused memory. For example, after creating a massive list of strings, let's say the list uses 30MB of memory, so the entire process takes roughly 40MB, when the list is deleted, the process still consuming 40MB, but if another list with the same amount of data is created, the process will not take more memory, because it will use the virtual memory that is available but not released to the OS.
My question is: What kind of data will reuse that non-released virtual memory? I mean, that 30MB was "taken" from the OS when I created a list of strings, and even when I delete it, the next list of strings will not take more memory from the OS as long as it fits in the 30MB. But if instead a list of strings another type of data is created, like a QPixmap (from Qt, using PyQt), will it use that 30MB originally allocated by the list of strings?
Thank you in advance.
Edit: Well, this question sounds lazy. I know I could simply test this specific case, but i want to know in theory, I don't want the answer for this "list of strings and qpixmap" specific case, but in general.
| true | 8,836,536 | 1.2 | 0 | 0 | 0 |
At the C level (CPython's implementation), anything that is allocated on the heap with malloc() will consume memory and this memory will not be released to the OS when that memory is freed with free(). It will only be returned when the process dies. But when new blocks are allocated with malloc() they will use the freed-up memory.
(Unless the free memory is really badly fragmented and there is not enough contiguous free space in the freed-up zones to accommodate new allocations. But let's not worry about this pathological case.)
Every Python object is implemented by CPython as one or more blocks of memory allocated with malloc() so the answer to your question is: pretty much any piece of Python data can reuse the space that was freed by the deallocation of some other piece of Python data.
| 1 | 3,099 | 0 | 1 |
2012-01-12T14:18:00.000
|
python,memory-management,virtual-memory
|
Virtual memory management in Python (2.6-2.7) - Will it reuse the allocated memory for any type of data?
| 0 | 1 | 2 | 8,836,643 | 1 |
0 | 0 |
A simple question, (hopefully with a simple answer).
QTreeView will pass Qt.DisplayRole to the model's data function when fetching rows for display, by default.
But say I wanted to pass 'MyAwesomeTreeDisplayRole' instead of Qt.DisplayRole, what would I need to do?
I can't seem to find anything about where the view decides to use displayrole or how to override it.
Just before you ask why I want to do such awful things..
Basically, my QAbstractItemModel is intended to be usable both for a treeview (1 column) and a tableview (multiple columns, based on parent).
Using the same DisplayRole for both types of views doesn't really work, since then I'm forced to return the same data for both. This results in me only seeing the first column in the treeview when I want to return a concatenation of a couple of columns.
I think the simplest way would be to just use custom roles (TreeDisplayRole and TableDisplayRole).
Thanks in advance.
| false | 8,860,192 | 0 | 0 | 0 | 0 |
I've used QTreeView to view a simple table with many columns - it works well - you can adjust the column count by sending it the columnCountChanged signal. So I'm not sure you need to do what you are asking.
But I've used ItemDelegates too: use my_treeview.setItemDelegate() to point the treeview to your item delegate. If this subclasses QStyledItemDelegate then it doesn't need to do much work - it can mostly just pass it all through to super.
The user roles then are just agreed between your custom ItemDelegate and your ItemModel and can be anything you like as long as they are >= than QtCore.Qt.UserRole.
(Edit: Sorry, I put this in as a new answer but it's really just an elaboration on what Lol4t0 said - apart from the columnCountChanged thing)
| 0 | 1,128 | 0 | 2 |
2012-01-14T04:40:00.000
|
python,qt,model,pyqt
|
Using custom role in QTreeView instead of DisplayRole
| 0 | 1 | 2 | 9,890,722 | 1 |
0 | 0 |
As the title suggests it, I`m looking for the best solution for creating a 2D or a 3D graphic simulator. I need to build a program that simulates the behavior of some custom solar panels (how the rays fall on the surface of the panels, what happens if the panels are rotated etc). The main problem is that it has to be done in a very short amount of time and depending on how big the difference between the 2D and the 3D one will be (in terms of needed time for completion), I will choose the most appropriate solution. The program has to create also some charts based on the input data.
Thus, I`m interested looking for you suggestions in regard to which one of the aforementioned languages would provide the best and easiest to use tools (for both the 2D and the 3D one), and a good combination of the final code complexity, ease of the graphic design and final appearance.
| true | 8,866,301 | 1.2 | 0 | 0 | 4 |
If you don't have much time you should choose the language you know better.
Personally I'd go for python because I think it's a very productive language. To do the rendering I'd rely on the module pygame. Nevertheless there are numerous possible libraries that can do what you need. I've used XNA a while ago and it was a real pleasure. Especially its support for 2d graphics is excellent. On the bottom-line I guess it boils down to this:
Python is "working pseudo code". It will allow you to code the logic very efficiently. Pygame however is a 3d game library. It's great for creating games and visualizations but you'll have trouble to make a nice gui.
C# is a little more "heavy" than python. You'll definitely end up writing more code, just in terms of the number of lines. XNA + WPF is a powerful combo though and has very good tools - VisualStudio has a great gui designer
| 0 | 1,475 | 0 | 0 |
2012-01-14T23:33:00.000
|
c#,python,graphics,simulator
|
C# vs. Python - Best choice for a 2D/3D graphic simulator
| 0 | 1 | 3 | 8,866,408 | 1 |
0 | 0 |
I would like to know how to draw images using pygame. I know how to load them.
I have made a blank window.
When I use screen.blit(blank, (10,10)), it does not draw the image and instead leaves the screen blank.
| false | 8,873,219 | 0.148885 | 0 | 0 | 3 |
After using blit or any other update on your drawing surface, you have to call pygame.display.flip() to actually update what is displayed.
| 0 | 36,330 | 0 | 16 |
2012-01-15T20:43:00.000
|
python,image,pygame
|
What is a good way to draw images using pygame?
| 0 | 1 | 4 | 8,873,270 | 1 |
0 | 0 |
I have a window that is opened up in a Python script (NOT THROUGH Tkinter), and all I want is to send an "enter" (keypress) command to that window. I was hoping I could do this with Tkinter, but I'm at a bit of a loss as to how to send this command to the current focused window.
| false | 8,898,662 | 0 | 0 | 0 | 0 |
You cannot do this with Tkinter. Tkinter can only send events to its own windows.
| 0 | 260 | 0 | 1 |
2012-01-17T17:02:00.000
|
macos,tkinter,python-2.7
|
Tkinter keypress on current focused window
| 0 | 1 | 2 | 8,900,000 | 1 |
0 | 0 |
What is the best framework to use for building the GUI on a python widget?
I'm currently using gnome 3, but would prefer it to be independent of the desktop environment.
| false | 8,905,128 | 0.066568 | 0 | 0 | 1 |
I have used the 3 following toolkits.
wxPython is a popular choice. It supports Windows, Mac and Linux but may be tricky to install on some of these platforms (that's what i've recently noticed on 64 bits MAC and Ubuntu). It has a lot of nice widgets which can be seen with the demo app that can be downloaded separately. I do recommend to have a look to this app. In my opinion, it is missing a great form designer even if wxFormBuilder seems to be a good tool. I am less confortable with Xrced which is another graphical form designer but you may prefer this one.
PySide is the python wrapper for Qt. It seems to me as a very professional toolkit. It is cross-platform as well and have a very good graphical form designer (QtDesigner). It is the best choice for open-source development. If you want to make a commercial app, you would have to buy a license which is in my opinion a bit expensive for small to medium size projects. (that's why I didn't use Qt recently)
TkInter is included in the Python standard lib and is also cross-platform. I like it very much and I am using it for my little apps. For bigger projects, i think that it is missing widgets, documentations and a easy-to-use graphical designer. If you have a little time to dive into this lib, it may not be a problem.
I hope it helps
| 0 | 1,565 | 0 | 0 |
2012-01-18T04:19:00.000
|
python,gtk,widget,gnome
|
Python Widget/GUI framework
| 0 | 1 | 3 | 8,906,510 | 1 |
0 | 0 |
I was wondering if any of you know where I could find a simple tutorial on the web maybe to make a very simplistic gui. I have no idea how to start out in code to make one so I need your help. What I want the gui to be used for is I have written a program that I want to be to use it on other computers that already don't have python on it. I have already made an executable but I would much rather use a gui just because of the more "polished" look it has.
| false | 8,912,327 | 0.019997 | 0 | 0 | 1 |
If you're more into gaming you can use PyGame for GUIs.
| 1 | 104,449 | 0 | 23 |
2012-01-18T15:03:00.000
|
python,user-interface
|
How to make a gui in python
| 0 | 2 | 10 | 8,913,722 | 1 |
0 | 0 |
I was wondering if any of you know where I could find a simple tutorial on the web maybe to make a very simplistic gui. I have no idea how to start out in code to make one so I need your help. What I want the gui to be used for is I have written a program that I want to be to use it on other computers that already don't have python on it. I have already made an executable but I would much rather use a gui just because of the more "polished" look it has.
| false | 8,912,327 | 0 | 0 | 0 | 0 |
While some suggestions have included tkinter and wxPython, the other part of the answer to your question is that you will also need to package it using something like py2app, pyinstaller, or py2exe (depending on the operating system). You mentioned the other machines do not have python, so this would be required in order to distribute the entire python environment with your app.
Also have a look at PySide or PyQt. They have a ton of tutorials everywhere and heavy documentation from Qt.
| 1 | 104,449 | 0 | 23 |
2012-01-18T15:03:00.000
|
python,user-interface
|
How to make a gui in python
| 0 | 2 | 10 | 8,912,460 | 1 |
0 | 0 |
EDIT: Solved, thanks everyone!
What I would like to be able to do in simple terms is take user input from one programming language, convert it into another programming language and have it compiled automatically.
For example (simplified and not precisely what I want to do but along similar lines):
1) Write a python script, userData = raw_input("blah blah blah, example, example")
2) if userData == "blah blah blah, example, example", serialize to a text file called "example.cpp" and put in some predetermined data which is based on the user's input (written in C++ form, though represented as a string in python script). For simplification this predetermined data will be called predeterminedData.
3) The extent of predeterminedData will be essentially a cout << "this is a different message to before" << endl;
4) The compiler (g++/gcc) compiles this automatically and the overall program structure calls the newly created executable file.
If someone could help point me toward the topic/topics I should read up on to be able to achieve this - if it's possible - that'd be fantastic.
Edit: I've made a classic mistake I think. In an attempt to not be accused of asking other people to do my "homework" for me I've been too vague and consequently misleading. Thank you for the responses so far but perhaps now I should be more specific. It isn't particularly python nor c++ specific but I will explain beneath. I apologize for not being more explicit before.
What I actually want to achieve is quite simple. I want to use user input from one programming language (python, c++, java) and have it create a Lilypond script which will automatically compile and create a midi file.
So for example:
1) User is asked to enter alphabetically a series of notes: e.g. "C" then "E" then "F", so on and so on.
2) These "notes" are checked by a control loop statement and a string is created in the Lilypond script and serialized to a file which is compatible with its compiler (example.ly)
3) This file is automatically compiled by the Lilypond compiler and creates a midi file (example.midi)
4) Later in the program this example.midi can be called on and played back because of this creation process. It would not have existed prior to this creation.
| true | 8,918,183 | 1.2 | 1 | 0 | 5 |
To me it sounds like you just want to write a user interface for interactive creation of lilypond files.
I don't see what all this has to do with compilation. Your python script will need to write a file in lilypond notation and afterwards your script needs to call lilypond on that file (e.g. with os.system). You could even skip writing to a file and just pipe the output to stdin which lilypond can also read.
| 0 | 161 | 0 | 0 |
2012-01-18T22:06:00.000
|
c++,python
|
Automatic compiling between languages
| 0 | 1 | 1 | 8,918,813 | 1 |
0 | 0 |
I have a treeview that is populated from a treemodel.
I would like to add a colum to the treeview. Is it possible to draw the data for that column from a separate treemodel or can I append at runtime a column to the existing treemodel?
| false | 8,930,460 | 0 | 0 | 0 | 0 |
In a gtk.TreeView object there's an append_column method, so yes, you can programmatically add a column to a gtk.TreeView.
However, I'm not aware of any method for adding a new column to an existing model or using multiple models for the same gtk.TreeView. Anyway, I guess you can create a new model with an extra column, copy the contents of the previous one and update the tree view to use the new model.
| 0 | 1,854 | 0 | 5 |
2012-01-19T17:24:00.000
|
python,gtk,pygtk,gtktreeview
|
Can I add a column to an existing treemodel in gtk?
| 0 | 2 | 3 | 8,931,266 | 1 |
0 | 0 |
I have a treeview that is populated from a treemodel.
I would like to add a colum to the treeview. Is it possible to draw the data for that column from a separate treemodel or can I append at runtime a column to the existing treemodel?
| false | 8,930,460 | 0 | 0 | 0 | 0 |
To answer the question in the title: No, you can't add columns to a GtkTreeModel after it's been created.
| 0 | 1,854 | 0 | 5 |
2012-01-19T17:24:00.000
|
python,gtk,pygtk,gtktreeview
|
Can I add a column to an existing treemodel in gtk?
| 0 | 2 | 3 | 32,256,786 | 1 |
0 | 0 |
i am grabbing PIL images with screengrab from the screen, saving them in a queue and writing them into a jpg image sequence.
I use a producer thread to capture and a worker to write the images down to disk.
However i noticed, that this queue gets really large really fast, even though the written output is not really that large, when compressen with jpg. That leads to the grabs being put into extended memory on the disk, making the write process even slower. Since my data comes in bursts, i can use up some time to write to the disk, but if the memory is written to disk, it gets just too slow.
Is there a way to compress the images before adding them into the queue?
cheers,
| false | 8,938,442 | 0 | 0 | 0 | 0 |
Here's an idea, merge the images as they come in.
After a set period of time or set amount merged, compress the image. Divide the image back into separate ones.
/profit
| 1 | 775 | 0 | 2 |
2012-01-20T08:15:00.000
|
python,python-imaging-library,screen-grab
|
Reducing PIL image size in memory
| 0 | 1 | 1 | 8,938,645 | 1 |
0 | 0 |
I'd like to make a simple GUI that offers buttons which I can drag and drop into other Windows applications such that this other applications receives a certain string depending on the button chosen.
What would be the easiest GUI framework for Python that allows this drag and drop?
| false | 8,943,446 | 0.066568 | 0 | 0 | 1 |
Theoretically, you can use any library for which a graphical drag-and-drop designer exists. Such tools often generate markup language which the library parses, and sometimes they generate code directly. The latter is language-dependent whilst the former shouldn't be. Either way, you'll find a way of doing it with Python.
Practically, some libraries have better visual designing tools that others. WinForms designer was really elegant and seamless when I used it, so maybe IronPython? How about PyGTK, with Glade, or the aforementioned PyQt? Maybe Jython using Swing designed in NetBeans?
EDIT: Whoops, I didn't read the question properly. What you're looking for is a framework with drag-and-drop capabilities, i.e. most of them. There's lots of things to consider though, for example are the destination and source windows going to be from the same process? Will they be written with the same framework? These things could be relevant or not, depending on how it's all written.
| 0 | 1,910 | 0 | 2 |
2012-01-20T15:06:00.000
|
python,windows,user-interface,drag-and-drop
|
Simple GUI Windows Drag&Drop
| 0 | 1 | 3 | 8,944,479 | 1 |
0 | 0 |
A real newbie question here.
I'm using IDLE 2.7.2 on OSX 10.7.2 and reading Zelle's Python:Programming. I haven't programmed since the 80's, so after going through the command line stuff, I'm excited to dive into Objects. I grab his graphics.py file and copy it into documents (this seems like the default location for IDLE) and start up IDLE.
He then suggests a few commands into the shell:
from graphics import *
win = GraphWin() #which opens a graphics window with no problem
He then goes on to have you draw some lines and shapes in the window. Those graphics show up just fine in the window.
Here's my problem. If I try to mouse over the graphics window, I get the Mac pinwheel. Moving the window doesn't help. So the window seems like it's crashing (though IDLE is doing fine), but strangely, if I keep entering commands into IDLE, the shapes keep drawing normally in the window.
Am I doing something wrong? Is this normal? Thanks,
Henry
| false | 8,972,462 | 0 | 0 | 0 | 0 |
Idle runs the python commands you enter in another process, so it's reasonable to expect this "lock up" behavior to be different between the program controlled window and Idle.
What's probably going on, though is that everything is fine, but you have not yet started the event loop in the program you're typing in. The operating system notices that the program is not emptying out its event queue when you mouse over it (which creates lots of events) and it's helpfully informing you (by way of the pinwheel) that the program seems to be busy.
You will likely reach a point later in the tutorial where you do start the event loop, and the pinwheel will magically go away.
| 0 | 2,037 | 0 | 0 |
2012-01-23T13:35:00.000
|
python,python-idle
|
Graphics Window Crashing in IDLE
| 0 | 1 | 1 | 8,972,537 | 1 |
0 | 0 |
I'm running into some really weird problems with ctypes. I'm using ctypes to interface to a C++ library that has a C interface. The library has lots of parallel functionality. More often than not, the parallel calls tend to end up with a segfault from the C++ layer, but I've run into them with some serial code too. I'm wondering if there is any restriction on whether the Python interpreter and the C++ code need to be compiled with the same version of the C++ compiler? If so, how do I find out what c++ was used to build Python? I've tried to run strings on Python and grep for gcc and g++, nothing shows up.
| false | 8,989,328 | 0 | 0 | 0 | 0 |
CPython doesn't contain C++ code and thus there is no requirement with regards to the C++ compiler used to compile a C++ library loaded into a CPython process. However, the C layer and the C++ library must generally be compiled with the same C++ compiler. And if the C++ library or the C layer link against libpython, they must be compiled against the same version of CPython that is later used to run the ctypes code that loads the library.
| 1 | 337 | 1 | 2 |
2012-01-24T15:22:00.000
|
python,ctypes
|
ctypes - does python need to be compiled with same version as C library?
| 0 | 2 | 2 | 8,989,530 | 1 |
0 | 0 |
I'm running into some really weird problems with ctypes. I'm using ctypes to interface to a C++ library that has a C interface. The library has lots of parallel functionality. More often than not, the parallel calls tend to end up with a segfault from the C++ layer, but I've run into them with some serial code too. I'm wondering if there is any restriction on whether the Python interpreter and the C++ code need to be compiled with the same version of the C++ compiler? If so, how do I find out what c++ was used to build Python? I've tried to run strings on Python and grep for gcc and g++, nothing shows up.
| true | 8,989,328 | 1.2 | 0 | 0 | 4 |
There's no requirement at all that the native library that you call with ctypes has to be built with a matching runtime. In fact there's not even a requirement that the native library even uses a C runtime.
For example you can use ctypes to call code written in other languages, e.g. Delphi. Or you can use ctypes to call Windows API functions which are not linked against MSVC.
I guess you'll have to look elsewhere to resolve your problem!
| 1 | 337 | 1 | 2 |
2012-01-24T15:22:00.000
|
python,ctypes
|
ctypes - does python need to be compiled with same version as C library?
| 0 | 2 | 2 | 8,989,579 | 1 |
0 | 0 |
I don't know if this is a simple matter of RTFM, but bear with me as it was a while ago I used a statically typed language...
I'm porting some C# code to IronPython, and I just stumbled on this statement below. I'm not at liberty to post the actual code, so I'll write it in pseudo code instead:
data_type_1 variable_1 = variable_2 as data_type_2;
where
variable_2 is a COM object from earlier parts of the code, variable_1 is a new variable, and data_type_1 is a class that interacts with the data in the COM object.
What does it mean? I'm guessing it is some form of conversion. How can I convert it to something IronPython can make sense of?
| false | 9,001,219 | 0.132549 | 0 | 0 | 2 |
The as operator is a "safe cast" operator, it converts the variable_2 to type data_type_2. If that conversion fails, it doesn't throw an exception but returns null.
Further, to be able to assign a value of data_type_2 (the result of the 'as' expression) to a variable of data_type_1, that data_type_2 must be derived from data_type_1 (or implement the interface data_type_1).
| 1 | 138 | 0 | 0 |
2012-01-25T10:35:00.000
|
c#,com,ironpython
|
How can I translate this C# variable declaration to something IronPython can handle?
| 0 | 2 | 3 | 9,001,555 | 1 |
0 | 0 |
I don't know if this is a simple matter of RTFM, but bear with me as it was a while ago I used a statically typed language...
I'm porting some C# code to IronPython, and I just stumbled on this statement below. I'm not at liberty to post the actual code, so I'll write it in pseudo code instead:
data_type_1 variable_1 = variable_2 as data_type_2;
where
variable_2 is a COM object from earlier parts of the code, variable_1 is a new variable, and data_type_1 is a class that interacts with the data in the COM object.
What does it mean? I'm guessing it is some form of conversion. How can I convert it to something IronPython can make sense of?
| false | 9,001,219 | 0.066568 | 0 | 0 | 1 |
After killing a few hours I figured I might as well do it the simple but perhaps not the prettiest way. I simply downloaded Visual C# 2010 Express (free version) and wrote a minimal Class Library containing one method consisting of only the troublesome statement. I then built the dll, which was promptly imported and used in the original IronPython script.
From idea to a working solution it only took 10 minutes. Kudos to Microsoft, it was a whole lot simpler to build a dll than I thought.
| 1 | 138 | 0 | 0 |
2012-01-25T10:35:00.000
|
c#,com,ironpython
|
How can I translate this C# variable declaration to something IronPython can handle?
| 0 | 2 | 3 | 9,004,636 | 1 |
0 | 0 |
I have created a program in Codeblocks (wxWidgets Application) I have compiled it and it runs perfectly when executed from the codeblocks interface ....however when i go into the release folder and run the executable it gives me *.dll file errors :/
How do i make the program ?
| true | 9,028,174 | 1.2 | 0 | 0 | 2 |
There's a good chance that Code:Blocks has a default setting for the executable path that includes the path to the libraries. As Windows finds the DLLs using the PATH environment variable this will ensure that your application works inside CodeBlocks.
However in order to run it outside CodeBlocks you'd need to either copy all the dependencies into the directory that holds your application or you'll have to set your PATH variable to include the directories that hold the dependencies.
| 1 | 825 | 0 | 1 |
2012-01-27T02:11:00.000
|
c++,visual-c++,wxpython,wxwidgets,codeblocks
|
How to compile a program in wxSmith ( Codeblocks ) with all the libraries?
| 0 | 1 | 1 | 9,028,282 | 1 |
0 | 0 |
I use wxpython for GUI. In main thread I fired some threads in background and showed modal dialog in main thread immediately. Now I want this modal dialog to be updated with some info at the moment all background threads finish they job. What's the best way to do this?
| false | 9,038,128 | 0.379949 | 0 | 0 | 2 |
Pass a Queue as an argument to the threads, and let them put() a done / result object into that. Then count them.
| 1 | 173 | 0 | 3 |
2012-01-27T18:19:00.000
|
python,multithreading
|
Execute action when all threads in except main are finished? (Python)
| 0 | 1 | 1 | 9,038,289 | 1 |
1 | 0 |
First of all, I am sorry if this question doesn't belong to SO since I don't know where else to post it, anyway...
I am looking for a decent python based database development RAD framework with nice data aware widgets and grids. A desktop framework would be much preferable to a web framework (I've developed heavy DB-centric apps in django but the web dev experience is still painful compared to a desktop one), although a web framework will do as long as there are powerful data-centric widgets to go along with it.
Ideally, it should be as useful as say Delphi or MSAccess / VBA (I used to develop using those a long time ago). For the record, I have very good development experience in django and wxPython and as I've said developing heavy data-centric web apps is tough and wxPython although very powerful lacks DB-related widgets.
Please note that the use of Python is mandatory because I've been using this language exclusively for all my projects in the last few years and I can't bear the idea of switching back to more mundane languages.
Thanks for any suggestion...
| false | 9,045,723 | 0.099668 | 0 | 1 | 1 |
I am also looking for something similar to Kexi. Unfortunately python scripting is not supported in Kexi for windows. I would like to find something better than MS Access, and it does not have to be based on python. So far I have looked at quite a few IDE's but have not found anything where a GUI and database application can be built us as quickly as in access.
I think of all the best one I have seen is Alpha 5. There could be something based on Net Beans but I really do not know. Oracle APEX is another one I have heard about but it doesn't support desktop applications (as far as I know).
| 0 | 684 | 0 | 3 |
2012-01-28T13:49:00.000
|
python,database,widget,rad
|
Python database widgets/environment like MSAccess
| 0 | 1 | 2 | 15,711,432 | 1 |
0 | 0 |
I just turned on the pygame.OPENGL flag in my set_mode out of curiosity. It made my code very unhappy: pygame.error: Cannot call on OPENGL Surfaces on the first screen.fill((0, 0, 0)).
I don't NEED OpenGL, but I'm kind of curious about it. Where could I find info about pygame/SDL and OpenGL?
| false | 9,047,958 | 0.379949 | 0 | 0 | 2 |
The OpenGL flag in Pygame is used to turn your window into an OpenGL projection for other libraries - such as Rabbyt or PyOpenGL - to use.
For sites on reading up on all of this, I would recommend starting out at the respective sites for PyGame, OpenGL, et al. I'd post links for them, but the spam protection mechanism requires for me to have some manner of reputation.
| 0 | 919 | 0 | 0 |
2012-01-28T19:35:00.000
|
python,opengl
|
Where can I find information about what/why pygame can(not) do with openGl surfaces?
| 0 | 1 | 1 | 9,048,066 | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.