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 | Do you have to have pygame installed to run pygame games? I have programmed a game in pygame on my Raspberry Pi (using the Adafruit WebIDE), and I don't want to have to run it on the Pi itself, so I am planning to use it on my Windows 8 box, and I don't have pygame installed on the Windows box. | false | 15,488,944 | -0.066568 | 0 | 0 | -1 | Yes, for a computer to run a program, it needs to have the modules included in the program. It's like saying that you want to solve a quadratic equation but numbers do not exist yet. Especially if you want to edit it on your computer, you would need to have Pygame installed. | 1 | 4,043 | 0 | 1 | 2013-03-18T23:36:00.000 | python,pygame | Do you have to have pygame installed to run pygame games? | 0 | 2 | 3 | 15,488,983 | 1 |
0 | 0 | I'm really trying to fall in love with Python and move away from Matlab. Is it possible to make Matlab style GUIs in Python? How easy is it by comparison? (I make matlab GUIs programmatically, wouldn't dare use GUIDE) Can I put matplotlib graphics in these GUIs? Is tk or wx (or something else) better for this? | false | 15,507,009 | 0.066568 | 0 | 0 | 1 | Haven't used Matlab before, not sure about it's GUI. But if you tend to use Python interactively, you may want to give iPython a try. Ipython with Qt can render you an elegant GUI. | 0 | 2,810 | 0 | 0 | 2013-03-19T17:59:00.000 | python,matlab,wxpython,tkinter | Can python make Matlab style GUIs | 0 | 1 | 3 | 15,508,213 | 1 |
1 | 0 | I want to learn how to how to program apps for Android. I am not very fond of Java. I read that you could build Android apps with Python and C++. So can I build apps completely without using Java? Also what are the advantages of C++, Python, and Java when building Android? Another question: Will Django Framework work for Android? Thank you for your time. | false | 15,514,294 | 0.291313 | 0 | 0 | 3 | You might want to checkout the likes of Phonegap, Scala, Groovy, Mirah, Rhodes, Clojure | 0 | 3,672 | 0 | 1 | 2013-03-20T02:38:00.000 | java,android,c++,python,django | Is it possible to build Android apps without Java? | 0 | 1 | 2 | 15,514,369 | 1 |
1 | 0 | I have c++ code that can be compiled under Linux, windows or Mac OS. The code compares two images. I would like to have its front end running on a browser and make available to the www.
I am familiar with hosting and dns and that is not the issue. what I can't seem to figure out is:
How do I invoke the script once the image is uploaded by users?
The results from the code needs to be displayed back to the browser. How can a callback be set up for this?
Is there a php solution? Or python (with flask)? | false | 15,519,904 | 0 | 0 | 0 | 0 | You can use sockets, and start listening on some port from C++ program, then from PHP you can connect and send/receive data to/from your program. | 0 | 959 | 0 | 0 | 2013-03-20T09:40:00.000 | php,c++,python,flask | Web front-end for c++ code | 0 | 1 | 3 | 15,520,011 | 1 |
0 | 0 | Does embedding c++ code in python using ctypes, boost.python, etc make your python application faster?
Suppose I am making an application in pygtk and I need some functions which need to be fast. So if I use c++ for certain tasks in my application will it be beneficial?
And what are other options to make python code faster? | false | 15,543,783 | 0.291313 | 1 | 0 | 3 | It depends, there's not a definitive answer. If you write bad code in C++ it could be even slower than well written Python code.
Assuming that you can write good quality C++ code, you can expect speedups up to 20x in the performance critical parts.
As the other answer says, NumPy is a good option for numerical bottlenecks (if you think in matrix operations rather than loops!); and SciPy comes with weaver, that allows you to embed inline C++ and other goodies. | 0 | 624 | 0 | 11 | 2013-03-21T09:34:00.000 | c++,python,c,ctypes,embedding | Does embedding c++ code in python make your python application faster? | 0 | 1 | 2 | 15,544,287 | 1 |
0 | 0 | My main question: can you have several processes write to one queue in a loop and use that queue to update a GUI?
I have been looking at the posts regarding queues and multiple processes and I was wondering if anyone had any idea if it is possible or beneficial to use combinations of them.
My thought process is this: since all processors are made now with ~8 cores, most programs I make should have the ability to access this power if there is any part of the program that is at all computationally expensive. I would like to have a GUI which displays the progress of several different processes at the same time. I would like each of these processes to use as much of the processors as possible, but they all have to write to the GUI at the same time, so from what I have read, it seems like a queue will work for this.
Is the best way to approach this to have several processes communicate to a queue via a pipe, and have the queue update the GUI?
At the moment I am using pyQt signals and slots but I feel this is a bad solution for modern times since it only uses one CPU core. | true | 15,575,872 | 1.2 | 0 | 0 | 1 | Most GUI systems are event driven and expect all event handling to come from a single thread. This is true of the Windows event system, Android events, Swing, and probably many others. In the case of GUIs, the practical benefit of making all the event management functions thread-safe is small, while the difficulty is quite large. Most large scale concurrent systems do combine event based and thread based approaches to concurrency, for instance modern browsers. In your case, it's much simpler to just register an update event and have it posted to the event dispatching thread by your worker processes/threads. This way your GUI remains responsive to other windowing events as it is only being notified periodically. | 1 | 356 | 0 | 0 | 2013-03-22T16:54:00.000 | python,multithreading,user-interface,parallel-processing,queue | Shared queue across multiple processes | 0 | 1 | 1 | 15,576,036 | 1 |
0 | 0 | I am searching for month now and growing quite frustrated.
I just love python.
So after doing a lot of console based stuff I wanted to do some graphical UIs as well.
I am aware of most of the frameworks (wxpython, glade, tk etc).
But: I do not want to write the code for the GUI itself per hand! Declaring every element from hand, thinking about grids and doing a trail and error to find out just how many pixels you have to move an object to get it in the right place. Well, lets say that just sounds like 1990's to me, and it is no fun at all.
So to put it plain and simple, what I am looking for is a solution that allows me to design a GUI graphically (WYSIWYG) and have an event based linking to python code.
Almost all major languages have that: For C/C++ their are certainly the most IDEs/tools that can do that. For Java there is Netbeans with Wwing (example of what i want; it would be ideal if that UI designer in Netbeans could spit out jython code, but no: python is supported but not UIdesign). Even Mono/Visual Basic etc. has tools like that.
So why the hell is their nothing for python?
P.S. And please, no comments like "If you are are real programmer you do it by hand to get cleaner code". If I want something very specific I edit it by hand, but designing a standard UI by hand is a waste of time. | false | 15,591,618 | 0 | 0 | 0 | 0 | See Glade, particularly in use with the libglade Python bindings. | 0 | 5,155 | 0 | 0 | 2013-03-23T20:19:00.000 | python,wysiwyg | Is there really no event based wysiwyg Gui builder for python/jython etc | 0 | 1 | 3 | 15,591,769 | 1 |
0 | 0 | The python code: menu_item = gtk.MenuItem("après") gives a warning message: Gtk warning Invalid input string and the menu item is not shown. What should I add / change to have the menu item displayed? | true | 15,592,613 | 1.2 | 0 | 0 | 1 | Your editor is most likely saving the source file in another encoding, such as Latin-1 or Windows-1252, where GTK expects UTF-8. Try replacing "après" with u"apr\u00e8s".encode("utf-8"). If that makes it work, the problem lies there.
To correctly fix the problem, you need to:
declare the encoding to Python using the # -*- coding: utf-8 -*-
make sure your editor is saving the file in the declared encoding. If necessary, use a hex editor to verify this.
use Unicode string literals for non-ASCII strings, i.e. u"après" instead of "après". Where unicode strings are not accepted, use u"après".encode("utf-8"). PyGTK generally accepts Unicode strings, so explicit encoding to UTF-8 should not be necessary. | 0 | 460 | 0 | 0 | 2013-03-23T22:04:00.000 | python,gtk | Gtk gives a warning and won't show my menu item | 0 | 1 | 1 | 15,596,366 | 1 |
0 | 0 | Does anyone know a simple way to load a .gif image into python using pygame? I tried loading a .gif image using 'pygame.image.load(path)' which worked although only the first frame loaded.Ever since I had to use a loop to display multiple images at once. | true | 15,593,813 | 1.2 | 0 | 0 | 1 | Simply put, you cannot display multi-frame GIFs in Pygame, unless you use an extra library. Instead, explode your GIF. You will have to do everything manually, as Pygame does not control flow time, etc, which is necessary for animated GIFs. | 0 | 944 | 0 | 2 | 2013-03-24T00:41:00.000 | python,loading,gif | Loading a multiframe/moving .gif image into python using pygame | 0 | 1 | 1 | 15,593,845 | 1 |
0 | 0 | Python noobie.
I'm trying to make Python select a portion of my screen. In this case, it is a small window within a Firefox window -- it's Firebug source code. And then, once it has selected the right area, control-A to select all and then control-C to copy. If I could figure this out then I would just do the same thing and paste all of the copies into a .txt file.
I don't really know where to begin -- are there libraries for this kind of thing? Is it even possible? | false | 15,626,786 | 0 | 0 | 0 | 0 | I would look into PyQt or PySide which are Python wrapper on TOp of Qt.
Qt is a big monster but it's very well documented and i'm sure it will help you further in your project once you grabbed your screen section. | 0 | 556 | 0 | 0 | 2013-03-25T23:34:00.000 | python,asp.net,python-2.7,screen-scraping,web-crawler | How to: Python script that will 'click' on a portion of my screen, and then do key commands? | 0 | 1 | 2 | 15,627,630 | 1 |
0 | 0 | By "reasonable" environment I mean that it should not require the user to manually install any dependencies of the application, but a working Python installation can be required. Additionally I would like the application to work on Windows, OSX, and popular Linux distributions. If I can package a Python interpreter as well, that's better. Size is not really a concern. A good example of what I want to accomplish is the SublimeText editor.
Is there an established way of doing this? | false | 15,679,272 | 0.197375 | 0 | 0 | 1 | Yes, python comes with setup utilities, and there are packages which will put your complete application in a platform specific binary(exe on windows, .app on osx).
Some of the packages I would recommend looking at would be:
cx_freeze
py2app
py2exe | 1 | 380 | 0 | 2 | 2013-03-28T10:20:00.000 | python,deployment,pyqt,pyside | How can I create a package of a PyQt/PySide application which can be expected to run in "reasonable" environments? | 0 | 1 | 1 | 15,679,428 | 1 |
0 | 0 | goal
Understanding how a radiobutton in a Tkinter menu works
code
I have a radio button inside the options menu as so:
v = BooleanVar()
v.set(True)
options.add_radiobutton(label="change pop up", command =togglePopUp,variable=v,onvalue=True,offvalue=False)
togglePopUp is a function that changes the value of variable v from True to False or vice versa. Main window is already opened and this menu will be added later to the window. This is just the fragment of code that is related to the radiobutton.
Question
Now my question is when I press the radiobutton (after running the code) will the value of the variable be changed or will the function togglePopUp be called? If the function will be called then what will happen to the status of the radiobutton? will the status of the radiobutton be updated instantly or will there be a delay?
research
I read about the radiobutton and the Boolean variable from the Tkinter book at effbot.org. But I was not convinced about how it worked. I tried a program but I am not getting the output that I essentially want. So I decided to understand how it works at a deeper level.
specs python 2.7 Tkinter 8.5
Linux Mint 14 | true | 15,700,627 | 1.2 | 0 | 0 | 3 | Both actions will occur. When you click on a radiobutton, first the variable will change its value, and after that the event handler passed as command option is called if present.
Also your example would not work, since add_radiobutton doesn't allow the onvalue and offvalue options - only value. | 0 | 4,326 | 0 | 3 | 2013-03-29T09:32:00.000 | python,tkinter | Radio button in a Tkinter menu | 0 | 1 | 1 | 15,724,761 | 1 |
0 | 0 | I've managed to make a single working executable file (for Windows) from a PyQt based Python app using PyInstaller, but is it also possible for Linux?
On linux machine (LUbuntu), when I run the .py script, I've got errors about missing PyQt bindings and I can't even download them by apt-get because of inability to connect the servers. It would be much more convenient to somehow pack the missing libraries to my program's files in order to make it more portable, but how can I do it? | true | 15,714,976 | 1.2 | 0 | 0 | 0 | If you package your application in the Linux distribution's package format, it can contain dependency information. That is the canonical solution to this problem.
Otherwise you'd have to include all nested dependencies to make sure that it'll work. | 1 | 1,029 | 1 | 0 | 2013-03-30T04:29:00.000 | python,linux,pyqt,portability,python-bindings | How to convert a Python PyQt based program to a portable package in Linux? | 0 | 1 | 1 | 15,716,571 | 1 |
0 | 0 | How do I create a bitmap button with attached text label in wxpyython. I have not come across any such generic buttons till now. I believe I will have to create one myself. How do I do it?
Thanks in advance | false | 15,721,749 | 0.379949 | 0 | 0 | 2 | Look at the wx.lib.buttons module for various flavors of generic buttons.
Also, in the 2.9 release series the stock button class (wx.Button) can have a bitmap + text label. | 0 | 1,315 | 0 | 0 | 2013-03-30T18:09:00.000 | python,wxpython,wxwidgets | Bitmap Button with attached text label in wxPython | 0 | 1 | 1 | 15,724,389 | 1 |
0 | 0 | I was wondering if there was a way to make a slider static under certain conditions, i.e. the program is under trial license.
One solution I've thought up was putting an image instead of a slider, but I'd prefer a static slider.
Is there a way I could do this?
Thanks!! | true | 15,745,398 | 1.2 | 0 | 0 | 3 | You can use the state=DISABLED option in the constructor, which is allowed in almost all Tkinter widgets. | 1 | 51 | 0 | 0 | 2013-04-01T14:33:00.000 | python,slider,tkinter | Making a python 2 Tkinter slider static under certain conditions | 0 | 1 | 1 | 15,745,558 | 1 |
0 | 0 | When i run this program i get an error that MinimaxNode' object has no attribute 'value'
ConnectFour is an other class that initializes the board and marks the moves, checks if someone won, etc.
Utility just returns 2 points (it is still in progress)
The problem arises that in MinimaxPlayer in child.get_minimax_value as it puts an error that MinimaxNode' object has no attribute 'value' | false | 15,775,010 | 0 | 0 | 0 | 0 | Your output you see is simply because you print out the object MinmaxNode, which must not have a __repr__ method set up.
Your error of "local variable 'col' referenced before assignment" is because you define col conditionally in your for loop but use it as an argument in play_turn regardless of whether it's been assigned. You should check that col has been defined after running your for loop and before calling it. | 0 | 164 | 0 | 0 | 2013-04-02T21:46:00.000 | python | Minimax For Connect four doesn't return a value | 0 | 1 | 3 | 15,775,072 | 1 |
0 | 0 | I want to add spreadsheet functionality to my wxpython application running on Windows. The CSheet module seems broken in the latest 2.9 version. It shows:
TypeError: EndEdit() takes exactly 4 arguments (5 given)
May I know if there is any suggestions to fix it or any other python module with good spreadsheet functionality ? I tried some but most of them are built on top of CSheet.
Thanks. | true | 15,778,593 | 1.2 | 0 | 0 | 0 | CSheet appears to just be a sub-class of Grid, so you could probably just use the Grid widget. Or you could go to wxPython's bug tracker on their website and submit this as a bug. They're usually pretty quick about patching stuff, especially in the 2.9 branch. | 0 | 203 | 0 | 0 | 2013-04-03T03:57:00.000 | wxpython | wxPython CSheet issue and replacement | 0 | 1 | 1 | 15,788,526 | 1 |
0 | 0 | When using the magic function %edit from QtConsole with IPython, the call does not block, and does not execute the saved code. It does however save a temporary file...
I think this is intended behavior due to GUI editors and uncertainty, and whatever that reason is for not being able to communicate with subprocess (pyZMQ?).
What do you suggest as the best way to mix %edit/%run magics?
I would not mind calling two different commands (one to edit, and one after I have saved and execution is safe). But those commands need a way to synchronize this target file location, or someone to persist storage, and probably need some crude form of predicatably generating filenames such that you can edit more than one file at a time, and execute in arbitrarily. Session persistence is not a must.
Would writing my own magic do any good? Hope we can %edit macros soon, that would do well enough to make it work. | true | 15,802,651 | 1.2 | 0 | 0 | 1 | you shoudl be able to do %edit filename.py and %run filename.py. The non blocking behavior is expected, and IIRC due to technical reason. Not unsurmountable but difficult.
You could define your own magic if you wish, improvement are welcomed.
Hope we can %edit macros soon, that would do well enough to make it work.
For that too, PR are welcomed. I guess as a workaround/option you can %load macro which would put macro on input n+1 , edit it and redefine it, that might be a good extension for a cell magic %%macro macroname | 1 | 883 | 0 | 0 | 2013-04-04T04:40:00.000 | edit,ipython,qtconsole | Ipython QtConsole %edit | 0 | 1 | 2 | 15,833,277 | 1 |
0 | 0 | I have been developing a wx.python application. at some point i need to create a fullscreen, no taskbar, etc. wx.Frame which has exactly the size of the screen and display in it a bimap which has exactly the dimensions of the screen, so one pixel of the bitmap equals exactly one pixel of the screen.
everything has been working fine (on dvi/vga/hdmi monitors) up to the time when i pluged in displayport monitor.
the monitor is detected by wxwidgets to be lower resolution than it actually is, so the bitmap goes off the screen. EDID still detects valid resolution so it is for sure wxwidgets related issue.
when i use wx.DisplaySize - it returns lower resolution than is actually set. i also tried to create the bitmap according to the wx.DisplaySize() output but then, as expected, when i try to light up one pixel, its neighbours are changed too. (some sort of scalling occurs).
similar issue occurs when i plug a projector.
have any of you had simmilar symptomes? how to deal with it? | true | 15,817,272 | 1.2 | 0 | 0 | 0 | So i found the solution of the problem.
It is because when I was plugging the different monitor - for some reason the DPI was changing. Adjusting the settings in the windows display control panel did the thing. | 0 | 110 | 0 | 0 | 2013-04-04T16:59:00.000 | wxpython,wxwidgets | weird scalling on displayport monitors in wx.python | 0 | 2 | 2 | 16,090,332 | 1 |
0 | 0 | I have been developing a wx.python application. at some point i need to create a fullscreen, no taskbar, etc. wx.Frame which has exactly the size of the screen and display in it a bimap which has exactly the dimensions of the screen, so one pixel of the bitmap equals exactly one pixel of the screen.
everything has been working fine (on dvi/vga/hdmi monitors) up to the time when i pluged in displayport monitor.
the monitor is detected by wxwidgets to be lower resolution than it actually is, so the bitmap goes off the screen. EDID still detects valid resolution so it is for sure wxwidgets related issue.
when i use wx.DisplaySize - it returns lower resolution than is actually set. i also tried to create the bitmap according to the wx.DisplaySize() output but then, as expected, when i try to light up one pixel, its neighbours are changed too. (some sort of scalling occurs).
similar issue occurs when i plug a projector.
have any of you had simmilar symptomes? how to deal with it? | false | 15,817,272 | 0.099668 | 0 | 0 | 1 | Correct EDID values does not necessarily mean that the system is running it in that display mode. Have you checked the system's display properties or screen resolution properties to ensure that the system is driving the display at its full resolution? Your symptoms sound to me like it is running at a lower resolution and the display is stretching it to fill the full screen. | 0 | 110 | 0 | 0 | 2013-04-04T16:59:00.000 | wxpython,wxwidgets | weird scalling on displayport monitors in wx.python | 0 | 2 | 2 | 15,822,502 | 1 |
0 | 0 | We already know that we can convert from ui to py easily with pyuic4.
Is possible to convert .py (that only contains pyqt ui related stuff) code back to .ui. | false | 15,822,786 | 1 | 0 | 0 | 11 | I can give you an example of why such a thing: when you inherited a project and the original developer didn't place the ui files in the repository (only left there the generated by pyuic4). True, that is a very particular example and that's also my reason why I'm trying to find something (is not a matter of one single ui file).
In a more generic way I can imagine that this would had happen to the previous developer in case of a disk fail.
Yes, I'm completely agreed that such a tool is not a normal thing to be provided like pyuic4... | 0 | 20,658 | 0 | 6 | 2013-04-04T22:23:00.000 | python,user-interface,pyqt,pyqt4 | Converting .py to .ui file | 0 | 2 | 2 | 17,655,662 | 1 |
0 | 0 | We already know that we can convert from ui to py easily with pyuic4.
Is possible to convert .py (that only contains pyqt ui related stuff) code back to .ui. | true | 15,822,786 | 1.2 | 0 | 0 | 1 | Qt/PyQt doesn't come with a tool for that, and AFAIK nobody's written one.
And it's hard to imagine why you'd need it. Just keep the .ui file around, and never edit the generated .py file (or even use the .ui file dynamically at runtime with uic), and you'll never need to reverse-convert.
Meanwhile, if you've got some random PyQt4 code that generates a GUI that wasn't even created by pyuic4, there's no guarantee that any .ui could possibly generate the code. (In fact, most of the PyQt samples you'll find online don't do things the same way pyuic4 would, and most likely any other code generator will similarly not do things the same way pyuic4 does.) | 0 | 20,658 | 0 | 6 | 2013-04-04T22:23:00.000 | python,user-interface,pyqt,pyqt4 | Converting .py to .ui file | 0 | 2 | 2 | 15,822,891 | 1 |
0 | 0 | I'm having trouble importing a resource file. I'm using pyqt4 with monkey studio and I am trying to import a png image. When I run the program I get an import error like
ImportError: No module named icon_rc
I know that I have to compile it using pyrcc4 but I don't understand how to do this can anybody help please. It would be very helpful to have an answer that fully explains how to compile the resource file so I can import it. | false | 15,864,762 | 0 | 0 | 0 | 0 | you could try with pyside as well like:
--- pyside-rcc -o input.qrc output.py | 0 | 49,757 | 0 | 15 | 2013-04-07T16:30:00.000 | python,pyqt,pyqt4,resource-files | PYQT4 - How do I compile and import a qrc file into my program? | 0 | 2 | 5 | 47,707,774 | 1 |
0 | 0 | I'm having trouble importing a resource file. I'm using pyqt4 with monkey studio and I am trying to import a png image. When I run the program I get an import error like
ImportError: No module named icon_rc
I know that I have to compile it using pyrcc4 but I don't understand how to do this can anybody help please. It would be very helpful to have an answer that fully explains how to compile the resource file so I can import it. | false | 15,864,762 | 0.197375 | 0 | 0 | 5 | In Pyqt5 this command can be used Pyrcc5 input_file.qrc -o Out_file.py
We need to convert that qrc file into python file and then it can be imported to your code | 0 | 49,757 | 0 | 15 | 2013-04-07T16:30:00.000 | python,pyqt,pyqt4,resource-files | PYQT4 - How do I compile and import a qrc file into my program? | 0 | 2 | 5 | 44,592,514 | 1 |
0 | 0 | I was wondering how I fill a wxChoice with content at runtime.
When creating the GUI I do not have the information of the content since it depends on the users what directory to choose.
What am I doing? The user will have to select a directory from a wx.DirDialog. The event handler refers to a function that will search for files of certain type and the results will be returned as a list of strings.
The list of strings should be used to fill/update the wx.Choice widget but I do not how to do this at runtime.
Does anybody has a solution for this problem?
Cheers Thomas | false | 15,873,307 | 0.099668 | 0 | 0 | 1 | I personally think that SetItems(listOfItems) is the quickest way of doing it and it works for several other widget types as well, such as ComboBox. The answer that Thomas mentions forces the developer to clear the widget and then Append individual items OR use AppendItems to add a list of items. Either way, that's a 2-step process compared with just using SetItems() | 0 | 477 | 0 | 0 | 2013-04-08T07:14:00.000 | python,wxpython | Fill wx.Choice at runtime | 0 | 1 | 2 | 15,888,610 | 1 |
0 | 0 | I'm writing an application that displays the content of a database table. My application shall display an image associated with each tuple/row, among textual and numeric data.
The trouble is that I am dealing with huge data sets (up to 50k entries). The user will, of course, never see more than a few entries at once. But he should still be able to browse the data in a table-like view.
Regarding the visual appearance, QTable would just do the job. But, after reading blog posts about this, QTable seems to be pretty slowish for such tasks, which is understandable since, for let's say 50k entries, on the order of 50k widgets QObjects need to be created.
I though of using a QSlider as a replacement for the scrollbar of the table and a fixed layout. Whenever the slider is changed, the content of the gui-elements that make up the rows are adjusted.
However, is there any Widget and/or solution that provides the look and feel of a QTable but allows me to generate only those widgets that are actually displayed?
Many thanks in advance. | true | 15,889,166 | 1.2 | 0 | 0 | 1 | Overriding the paint-method of a corresponding delegate-class solves my problem. Thanks to cmannett85. | 0 | 292 | 0 | 0 | 2013-04-08T21:17:00.000 | python,qt,pyqt | Qt: Alternatives to QTable for large datasets | 0 | 1 | 1 | 15,905,007 | 1 |
0 | 0 | I have a PySide application that connects a number of buttons to a function call that spins off a bunch of external processes (this isn't ideal, but it is necessary).
The function call takes less than a quarter of a second to run, but it still presents a chance for the user to outrun my code, causing lag, freezing, or crashing.
This leads me to a few questions...
What exactly does it mean for a callable to be connected to a signal? Suppose button A's click signal is connected a Python function f. If A is clicked, and then clicked again before f exits, does PySide simply queue another call to f, or does it do something fancier?
One possible solution is to make f disconnect itself from the signal and then reconnect before it exits. Before I go off rewriting things to try this, does anyone know if this is at all efficient, or if there is a more elegant solution? | true | 15,914,992 | 1.2 | 0 | 0 | 0 | I'm guessing it does exactly what every other GUI toolkit does, which is try to execute that function for every button press. If you don't want that, then there are several approaches you can take:
Disable the button until the function finishes
Use a sentinel value, like self.running, and add a check to see if it is True. If so, return. Otherwise, set it to True and execute. Just remember to set it back to False at the end of the function
Do what you mentioned and disconnect the function from the signal
Those are the main ones. I'm sure there are some more esoteric solutions out there too though. | 0 | 70 | 0 | 0 | 2013-04-10T00:36:00.000 | python-2.7,pyqt,pyside | Preventing PySide from Outrunning Python | 0 | 1 | 1 | 15,953,660 | 1 |
0 | 0 | Does Blender use OpenGl or DirectX? Or is it all done from scratch? | true | 15,916,324 | 1.2 | 0 | 0 | 9 | Does Blender use OpenGl or DirectX?
All graphics output of Blender is done using OpenGL.
Or does it use a programming language (python?) to do everything from scratch?
Why "or"? An API doesn't substitute a programming language. Blender has been programmed in C, C++ and Python. OpenGL is used to render everthing on screen, including the user interface. | 0 | 7,585 | 0 | 12 | 2013-04-10T03:19:00.000 | python,opengl,blender,cad | What was Blender created in? | 0 | 1 | 4 | 15,924,089 | 1 |
0 | 0 | Is there any Wxpython control that looks like a tabbed panels...I can use notebook but im not able to close the pages..I need something similar to IE, where you can open new tabs and close it when not needed.. | true | 15,974,476 | 1.2 | 0 | 0 | 1 | Have a look at the agw.flatnotebook. | 0 | 648 | 0 | 0 | 2013-04-12T14:50:00.000 | wxpython | wxpython control similar to tabbed panes | 0 | 1 | 2 | 15,974,678 | 1 |
0 | 0 | I have looked at the documentation but I can't seem to implement the full screen toggle. Could someone please show me an example of the correct syntax? | false | 15,993,287 | 0 | 0 | 0 | 0 | pygame.display.toggle_fullscreen() use this function | 0 | 2,962 | 0 | 1 | 2013-04-13T21:48:00.000 | python,user-interface,pygame | What is the correct syntax to enable fullscreen toggle in Pygame? | 0 | 1 | 2 | 60,500,908 | 1 |
0 | 0 | Is it possible to build an APK using Python for Android that doesn't need Python for Android to be there, i.e. it includes Python? If so, how? | false | 15,994,251 | -0.099668 | 0 | 0 | -1 | I think you can use py2exe to convert your programm to an .exe - File and then convert this .exe - File to an .apk - File. | 0 | 5,413 | 0 | 2 | 2013-04-14T00:01:00.000 | android,python,apk,sl4a | Python for Android APK without dependencies | 0 | 1 | 2 | 28,605,884 | 1 |
0 | 0 | How can I make that when checkbutton is checked that then all Sliders move like one by using python 3 and tkinter?
Thanks for any help! :) | true | 15,999,307 | 1.2 | 0 | 0 | 1 | First, you will need to save a reference to each of your sliders, which are instances of the Scale widget. Next, you will need to associate a command with the checkbutton (using the command attribute) which will be called whenever the checkbutton is checked or unchecked. In that command you can call the set method of each slider. | 0 | 132 | 0 | 0 | 2013-04-14T12:59:00.000 | python,slider,tkinter | Sliders and checkbtton in python 3 and tkinter | 0 | 1 | 1 | 15,999,600 | 1 |
0 | 0 | when reading python documentation and various mailing lists I always read what looks a little bit like a dogma. Global variables should be avoided like hell, they are poor design ... OK, why not ? But there are some real lifes situation where I do not how to avoid such a pattern.
Say that I have a GUI from which several files can be loaded from the main menu.
The file objects corresponding to the loaded files may be used througout all the GUI (e.g. an image viewer that will display an image and on which various actions can be performed on via different dialogs/plugins).
Is there something really wrong with building the following design:
Menu.py --> the file will be loaded from here
Main.py --> the loaded file objects can be used here
Dialog1.py --> or here
Dialog2.py --> or there
Dialog3.py --> or there
...
Globals.py
where Globals.py will store a dictionary whose key are the name of the loaded files and the value the corresponding file objects. Then, from there, the various part of the code that needs those data would access it via weak references.
Sorry if my question looks (or is) stupid, but do you see any elegant or global-free alternatives ? One way would be to encapsulate the loaded data dictionary in the main application class of Main.py by considering it as the central access part of the GUI. However, that would also bring some complications as this class should be easily accessible from all the dialogs that needs the data even if they are necesseraly direct children of it.
thank a lot for your help | false | 16,011,056 | 1 | 0 | 0 | 12 | Global variables should be avoided because they inhibit code reuse. Multiple widgets/applications can nicely live within the same main loop. This allows you to abstract what you now think of as a single GUI into a library that creates such GUI on request, so that (for instance) a single launcher can launch multiple top-level GUIs sharing the same process.
If you use global variables, this is impossible because multiple GUI instances will trump each other's state.
The alternative to global variables is to associate the needed attributes with a top-level widget, and to create sub-widgets that point to the same top-level widgets. Then, for example, a menu action will use its top-level widget to reach the currently opened file in order to operate on it. | 1 | 12,634 | 0 | 12 | 2013-04-15T08:45:00.000 | python,global-variables | How to avoid global variables | 0 | 1 | 2 | 16,011,147 | 1 |
0 | 0 | I was wondering if there is an online python interpreter with Pygame. It would be great if there is one, because when I share a game, I don't have to compile it first, I just send the code, and possibly upload the textures to a storage server and change the URL for the image location.
Is there an online Python interpreter with Pygame? | true | 16,044,608 | 1.2 | 0 | 0 | 4 | None that I'm aware of. Running a Pygame application in the browser would require some way of displaying graphics and playing sound from a remote Python interpreter. This would be pretty complicated to do, and would likely not perform very well anyway.
If you want to write games which run in a web browser, learn Javascript. | 1 | 10,085 | 0 | 5 | 2013-04-16T18:38:00.000 | python,pygame | Is there an online Python interpreter with the Pygame module? | 0 | 1 | 1 | 16,044,733 | 1 |
0 | 0 | Did Qt 5 and Qt Quick supported by last Version Pyside or PyQt ? | true | 16,048,056 | 1.2 | 0 | 0 | 3 | The latest version of PyQt (4.10?) works with Qt5. It does not support Qt Quick 2, AFAIK. I don't believe PySide supports either. | 0 | 2,837 | 0 | 3 | 2013-04-16T22:12:00.000 | python,qt,pyqt,qml,pyside | Pyside or PyQt support Qt 5.0 and Qt Quick 2 | 0 | 1 | 1 | 16,048,799 | 1 |
0 | 0 | I have a GUI developed using PySide. I have a long operation to perform from the interface, but there is no way to predict how long the operation will be. I'd like to display something to the user to tell him: the operation is in progress, please wait. Something like an infinite progress bar, or a spinning wheel. Is there a widget for such operation in Qt? I found the QProgressDialog (and QProgressBar), but it's not appropriate since I cannot predict the amount of work to perform. | false | 16,049,395 | 0 | 0 | 0 | 0 | If you want an infinite progress bar or spinning wheel, just have it play, then when you finish the process, stop and/or delete the bar/icon from the screen. | 0 | 3,339 | 0 | 2 | 2013-04-17T00:19:00.000 | python,qt,pyside | Progress bar for event with unknown duration (PySide) | 0 | 1 | 2 | 16,050,068 | 1 |
1 | 0 | I am trying to write a metronome application in Python, and I intend to publish the application for Android and iOS. I have found a few cross-platform frameworks like Kivy, but their audio support is lacking. More specifically, I need very precise audio timing and I can't rely on thread timing or events. I want to write audio data directly to the device's audio output, or create a MIDI file that can be played on the fly. The problem is, I cannot find any suitable framework for this task.
I know that many games have been written for Android in Python, and those games have excellent and precise sound timing. I need help finding either:
a way to create and play MIDI files on the fly in Android with Python,
a Python framework for Android with a suitable audio API to write sound directly to an audio device, or at least play audio with very accurate timing.
Thanks! | false | 16,088,764 | 0.197375 | 0 | 0 | 1 | I'm looking for the same thing. I too am looking at Kivy. The possible solutions I can see to audio is hooking in a 3rd party application as a "recipe" in Kivy.
There is aubio, which apparently can be compiled for iOS/Android (see stackoverflow question regarding this), but I believe you have to get your own audio source for it, which could be potentially handled by the audiostream subproject in kivy.
Kivy/audiostream imports the core libpd project it appears, so you can use libpd python bindings. I think this is the path of least resistance, but I had issues when trying to run the examples.
Both of these approaches, I think could work but both need some effort to be able to start using. | 0 | 1,422 | 0 | 1 | 2013-04-18T16:48:00.000 | android,python,kivy | Android Audio API in Python | 0 | 1 | 1 | 16,287,866 | 1 |
0 | 0 | Im trying to write an IronPython app that uses a COM object interface. I manage to import it using clr.AddReference, and manage also to call some of the functions, create objects, etc.
However at a certain point when trying to call a function I get :
StandardError: Error while invoking GetK300RZ.
(GetK300RZ being the function name.)
Why is this happening to me? What does this error mean exactly? could this be related to the 'embed interop types' option?
I would greatly appriciate any insight as to how to get around this problem...
Thanks | true | 16,131,781 | 1.2 | 0 | 0 | 0 | This is just for anyone who ever runs into this question with a similar problem - the problem was that the parameters of the functions were of type out and ref in C#. The function could not be invoked because there was no corresponding function signature. I had to use clr.Reference[] to explicitly create references for the function parameters.
I guess when using an external COM objects one should stop thinking python and start thinking .net or C#... | 0 | 126 | 0 | 0 | 2013-04-21T13:44:00.000 | .net,com,interop,ironpython | IronPython - error while invoking | 0 | 1 | 1 | 16,272,641 | 1 |
0 | 0 | I have downloaded and installed pygame and I know where it is (/usr/lib/python2.7/dist-packages). I am trying to get the program consisting of the line 'import pygame' to recognize its existence but I keep getting 'ImportError: No module named pygame'. How would I get it to work? | true | 16,133,352 | 1.2 | 0 | 0 | 1 | The installation packages for pygame are incompatible with python 3.x However, the vast majority of the pygame modules have been ported to python 3.x, so really it's simply a matter of moving the Pygame modules to your python 3.x dist-packages.
The scrap, _movie, surfarray for Numeric, and threads modules are the ones that have NOT been ported yet. | 1 | 691 | 0 | 0 | 2013-04-21T16:19:00.000 | python-3.x,pygame | Why can't the program recognize pygame? | 0 | 1 | 1 | 16,134,693 | 1 |
0 | 0 | issue
I am writing an application in python. It takes care of contacts and other information about a person. I want to prompt the user for a master key every time that he/she wants to perform a major operation. I have everything figured out. The whole application is ready and works well. But I store the master key in a file. This file is easily readable in the plain text form. And my friends who tried using this said that the software is useless if I don't apply a strong encryption algorithm as users would simply trust the application with the details that can be easily stolen.
goal
To store the master key in a form that can be deciphered (or read) only by my program.
other things
there is an option for the user to change the master key.
The master key will be read and deciphered only once. At the start of the program. It will be stored in a variable then and and used from this variable.
It is a GUI application. And I am using python Tkinter.
details
Please note that the data is stored using another encryption that is not un breakable but enough for this kind of information.
I have not used any database to store the information.
The only data to be encrypted is a master key. It is an alphanumeric string of length anywhere from 7 to 80 characters.
specs
1. Python 2.7
2. Tkinter 8.5
3. Linux Mint 14 | false | 16,142,113 | 0.07983 | 0 | 0 | 2 | You don't need, or even want, complex encryption for passwords--and what you are describing is a password, not a key (it just grants access, it doesn't encrypt the data). Current best practice is to store passwords salted and hashed. That is, when the user creates a new account and enters a password, you build a string from the password plus user name plus a "salt" (which is just a small string that's the same for everyone on your site--this is to thwart rainbow table attacks). Then you run that string through a good hash algorithm--something like SHA1 is fine (even MD5 is more than adequate, despite reports to the contrary). You certainly don't need anything like AES. Anyway, now that you have a hash, you store the hash in the database, and not the password. Even a strong cipher like AES is useless if don't do the rest right.
Next time the user logs in, you do the same: add his password to user name and salt, hash that, and compare the hash to what's stored. There's no way, even in principle, for you to know what his password was, so no way for an attacker to find it even if they get your database and know your algorithm and salt. | 1 | 859 | 0 | 1 | 2013-04-22T08:00:00.000 | python,encryption,tkinter | Encryption -- how to do it | 0 | 1 | 5 | 16,146,593 | 1 |
0 | 0 | What is the correct/official/proper/recommended way of accomplishing drag/drop in tkinter? My documentation section 24.1.1 includes:
Tkdnd Drag-and-drop support for Tkinter. This is experimental and
should become deprecated when it is replaced with the Tk DND.
but I can find no other official documentation. Does Tkinter have drag/drop support at all? Is this something version dependant? Is this something not yet included in tk(tcl) which will then filter through to tkinter?
I should stress that I am talking about drag/drop between different applications and that I am currently using python 2 (although any solution which relies on python 3 would still be of interest). | true | 16,143,460 | 1.2 | 0 | 0 | 6 | Tkinter has no built-in support for dragging and dropping between applications. Tkdnd is, AFAIK, the only way to accomplish it without writing the low level code yourself. | 0 | 11,082 | 0 | 9 | 2013-04-22T09:19:00.000 | python,python-3.x,drag-and-drop,tkinter | Drag and Drop in Tkinter? | 0 | 1 | 2 | 16,145,812 | 1 |
0 | 0 | What I am trying to achieve seems like it should be simple, but I can not find anything online to help.
I would like to take my pyqt program and, instead of using the command prompt, export all my print() commands to a qtextbrowser.
There are 2 parts to my question.
How do I disable the command prompt from showing up when the app is run.
How to output the print() commands to the text browser in real time.
I am using Python 3.3 and qt designer with pyqt4.
Thank you in advance!
Some of the code is confidential so if it is needed to help I can remove the sensitive info and post it. | true | 16,151,727 | 1.2 | 0 | 0 | 0 | I found out a solution. I was trying to do everything in my GUI thread. Im new to python but I am sure with some research I can teach myself threads. | 0 | 403 | 0 | 1 | 2013-04-22T16:12:00.000 | python,python-3.x,pyqt,pyqt4,python-3.3 | Real time command prompt export in text field using pyqt4 | 0 | 1 | 1 | 16,198,711 | 1 |
0 | 0 | I am trying to open the applications like notepad,photoshop,etc. inside the Tkinter window in Python. I tried using os.sytem() but it opens independently(not inside Tkinter window).
I had searched a lot about this but didn't got any solution. Any kind of help will be appreciated. | false | 16,167,995 | 0.197375 | 0 | 0 | 1 | You cannot do what you want. It is impossible to open an external program inside a Tkinter window.
While it is true that it's possible to embed some X11 based apps into an X11 based Tkinter application if the app was designed to be embedded, you will never be able to do this with non-X11 based apps. | 1 | 553 | 0 | 1 | 2013-04-23T11:18:00.000 | windows,python-2.7,tkinter,virtual-machine | How to open an exe file in Tkinter window | 0 | 1 | 1 | 16,169,706 | 1 |
0 | 0 | I used to use TKinter for my GUIS and am now trying to move to QT Designer. I am also new to event based programming. What I am trying to do is listen to communication on my serial port continuously after a start button has been pressed.
I want to call a function update() which takes in the data and manipulates it and writes it to a file. It must then handle any other events queued up before calling update() again. Obviously if I use a while loop my CPU usage goes to 100% and my GUI becomes unresponsive. In TKinter I got around this problem (messily) by using an after_idle call which called update() whenever the GUI was idle.
What is the best practice manner of doing this kind of thing using QT? | false | 16,185,594 | 0 | 0 | 0 | 0 | Use a thread to monitor the serial port. Use appropriate mechanisms to communicate with the UI (main) thead.
That way you can write your comm module without worrying about the event base nature of the UI. Of course you still cannot use a busy while loop to listen to the serial port. But using the usual read() methods with a time out is ok.
A Queue is well suitable to send data to the UI, and you can write files directly from you comm thread. | 0 | 260 | 0 | 1 | 2013-04-24T07:11:00.000 | python,qt,user-interface,qt-designer,serial-communication | Running continuous communications using QT and python | 0 | 1 | 1 | 16,185,984 | 1 |
0 | 0 | I have a program that displays many tkinter PhotoImages at once (relevant: I'm not using PIL). It currently has several screens, and when the play gets to the edge it loads a new tilemap, creating a bunch more photoimages in the currentTiles array after clearing the old contents. I'm fairly certain there are no other references to these photoimages in the rest of the program.
The weird thing is that when I print the contents of the last item in the array after the loadLevel function is called, it says things such as "pyimage3761", and it increments each time I load a new screen. Is this due to tkinter keeping track of how many have been created so far, or is it because the old tiles are still in memory? I can't for the life of me figure out where there could be another reference, so I'm just wondering if there are any other possibilities before I spend hours looking for errors.
Thanks!! | false | 16,241,755 | 0.379949 | 0 | 0 | 2 | Every created image is assigned a unique name (unless you specify the name of the image when creating). This unique name is generated by using a counter, which increases monotonically. | 0 | 238 | 0 | 1 | 2013-04-26T17:09:00.000 | python,tkinter | Tkinter PhotoImage: References in Memory? | 0 | 1 | 1 | 16,241,833 | 1 |
0 | 0 | Is there any way to add a custom image to the tkinter built in tkMessageBox? | true | 16,243,650 | 1.2 | 0 | 0 | 3 | No, there is not. You'll need to create your own message box with a Toplevel and some widgets. When you do that, you'll have complete control over what goes in the window. | 0 | 3,397 | 0 | 0 | 2013-04-26T19:15:00.000 | python,image,dialog,tkinter | Python Tkinter message box add custom image | 0 | 1 | 1 | 16,244,140 | 1 |
0 | 0 | I am new to TKinter and cant seem to find any examples on how to view a document in a window. What I am trying to accomplish is that when selecting a PDF or TIF it will open the file and show the first page in a window using TKinter. Is this possible? | false | 16,244,303 | 0.049958 | 0 | 0 | 1 | No, it is not possible to show a TIF or PDF in a Tkinter window. Your main options are to show plain text, and to show images (.gif with plain Tkinter, other formats if you include PIL - the python imaging library). | 0 | 6,715 | 0 | 1 | 2013-04-26T19:59:00.000 | python,tkinter | View a document TKinter | 0 | 1 | 4 | 16,244,366 | 1 |
0 | 0 | I am using wx.Grid to build spreadsheetlike input interface. I want to lock the size of the cells so the user can not change them. I have successfully disabled the drag-sizing with grid.EnableDragGridSize(False) of the grid but user can still resize the cells by using borders between column and row labels. I am probably missing something in wxGrid documentation. | true | 16,278,613 | 1.2 | 0 | 1 | 0 | I found the solution. To completely lock user ability to resize cells it is needed to use .EnableDragGridSize(False) , .DisableDragColSize() and .DisableDragRowSize() methods. | 0 | 426 | 0 | 1 | 2013-04-29T12:26:00.000 | python,wxpython | wx.Grid cell size lock | 0 | 1 | 1 | 16,279,016 | 1 |
0 | 0 | I have a Tkinter/ttk app that analyzes packets arriving every 10-25 ms. My present implementation uses a thread that updates 30 StringVars after every socket read, then calls update_idletasks() to update the corresponding Entry widgets. My app crashes no more than 30 minutes after starting.
Searches revealed that Tk isn't really thread-safe, and I have two main choices:
Use a thread + queues.
Use a function + .after(1, function).
The UI does little more than start/stop the updates, and provide the Entry widgets for display.
The primary wait in the system is the socket read, which has a timeout of 2x the expected packet rate (so it can't block forever).
In this case, would you prefer approach #1 or #2?
I'm leaning toward #2 for its simplicity, but I'm not sure if there are any Tk gotchas waiting along that path. I'll probably try both while I await the community wisdom. | false | 16,282,141 | 0 | 0 | 0 | 0 | I just implemented #2 (function + .after(1, function)) by changing literally 8 lines of code in my original implementation, and it runs perfectly. So #2 wins based on simplicity and effectiveness. It runs using 3-4% of 1 core (i5-2500, 3.3 GHz)
But if my UI becomes more complex, such as by adding stripchart recording via matplotlib animation, then queues and a separate acquisition thread may become necessary. But not today!
EDIT: But don't use .after(0, ...): My UI locked up when I tried it. | 0 | 548 | 0 | 0 | 2013-04-29T15:09:00.000 | python,tkinter,real-time,ttk | Real-time Tkinter/ttk Entry widget update: thread+queue or .after(1)? | 0 | 2 | 2 | 16,283,361 | 1 |
0 | 0 | I have a Tkinter/ttk app that analyzes packets arriving every 10-25 ms. My present implementation uses a thread that updates 30 StringVars after every socket read, then calls update_idletasks() to update the corresponding Entry widgets. My app crashes no more than 30 minutes after starting.
Searches revealed that Tk isn't really thread-safe, and I have two main choices:
Use a thread + queues.
Use a function + .after(1, function).
The UI does little more than start/stop the updates, and provide the Entry widgets for display.
The primary wait in the system is the socket read, which has a timeout of 2x the expected packet rate (so it can't block forever).
In this case, would you prefer approach #1 or #2?
I'm leaning toward #2 for its simplicity, but I'm not sure if there are any Tk gotchas waiting along that path. I'll probably try both while I await the community wisdom. | false | 16,282,141 | 0 | 0 | 0 | 0 | My personal rule of thumb is to avoid threads unless they are strictly required. Threads add complexity. Plus, there's a large percentage of programmers who aren't particularly thread-savvy, so threads add an element of risk if this program will be used or maintained by others.
That being said, in this particular case I think I'd go with thread + queues. Since you know how often the display should update, I'd set up a poll of the queue for every 10ms or so to update the widgets. | 0 | 548 | 0 | 0 | 2013-04-29T15:09:00.000 | python,tkinter,real-time,ttk | Real-time Tkinter/ttk Entry widget update: thread+queue or .after(1)? | 0 | 2 | 2 | 16,282,853 | 1 |
0 | 0 | I programmed a simple, little game with wxpython and created an .exe of it with py2exe (and in a 2nd try with pyinstaller). I also programmed an installer which just creates a folder and copies all the game files into this folder. I also created an .exe for this installer. Everything works fine on Windows 7. But on Windows XP i get this problem: My installer.exe succesfully works, but when I start the .exe from my game then I get this error:
foo.exe is not a valid win32 application
I use python 2.7 | false | 16,307,421 | 0 | 0 | 0 | 0 | Is the Windows 7 box you're using to create the installer 64-bit? Is the Python version you were using on Windows 7 64-bit? If so, then you'll need to create the exe using a 32-bit Python, 32-bit wxPython and 32-bit installer.
A 64-bit program will run just fine on a 64-bit system, but it won't work on a 32-bit one. However, a 32-bit program will run on both. | 1 | 1,262 | 0 | 0 | 2013-04-30T19:20:00.000 | python,wxpython | py2exe/pyinstaller: execution failure | 0 | 1 | 1 | 16,307,892 | 1 |
0 | 0 | I need help in pygame for 3.1 i am watching The New Bostons tutorials and whenever I put in
import pygame
from pygame.locals import *
I receive
Traceback (most recent call last):
File "C:\Documents and Settings\Aidan\Desktop\pygame.py", line 8, in
import pygame
File "C:\Documents and Settings\Aidan\Desktop\pygame.py", line 9, in
from pygame.locals import *
ImportError: No module named locals | false | 16,347,535 | 0.664037 | 0 | 0 | 4 | Your problem is that your script (or something else it imports) is already named pygame. So, Python can't find the package with the same name.
Just rename your script to something else, like my_game.py. | 1 | 156 | 0 | 0 | 2013-05-02T20:53:00.000 | python,pygame | Pygame python 3.1 | 0 | 1 | 1 | 16,347,585 | 1 |
0 | 0 | I try to write a simple 2d game using python 3.x and pygame 1.9.2. I want to simulate changing of days/nights. I have got in-game time(like real, but faster) and I'd like to make my screen darker at exact time but have no ideas how to do it. Could you advice me how to reduce the brightness of my screen or other ways how to show changing of days and nights?
Excuse for my language if I make mistakes. English isn't native for me) | true | 16,375,396 | 1.2 | 0 | 0 | 0 | Setting gamma or screen brightness is not the best way to go.
When your game gets more complicated, it's easier if you use the technique ecline6 suggested:
changing your background image.
But since it is a loaded image i suppose, you can use this trick:
Let's say you have a background surface. Every 10s you will fire an event that will change the backround by blitting an low alpha-black surface on top of it. That way your background will get darker.
You can do the same with white, to make it more brighter too. | 0 | 755 | 0 | 0 | 2013-05-04T14:33:00.000 | python,pygame | Changing days and nights with pygame | 0 | 1 | 1 | 16,377,757 | 1 |
0 | 0 | I´d like to create a program which will react on actions by user in real time. For example there will be three Labels. And when user clicks on one, I want to recolor the border to a different color and the user should be able to "type" a (single) number in this Label. I know about the Entry widget, but Labels are suitable for the whole application.
Thank you for any answers | false | 16,378,144 | 0 | 0 | 0 | 0 | Your question is too vague to answer precisely, but to specifically address each individual point:
Yes, it's possible to "react .. in real time" -- whenever an event is detected it will be acted upon as soon as possible.
Yes, it's possible to color the border of a widget when an event is detected
Yes, it's possible to type into a label. Though, obviously, the behavior is unusual and may not be what you expect.
I suspect none of those help you solve your real problem, but I have no idea what you're actually trying to accomplish. | 0 | 418 | 0 | 0 | 2013-05-04T19:29:00.000 | python,events,tkinter,label,real-time | How to react on actions (events) in real time in Tkinter? | 0 | 1 | 1 | 16,378,921 | 1 |
0 | 0 | I am soon going to be helping my friend create a 3D game with Python. Will I be able to use Tkinter for this (Which I doubt because the module only excepts .gif images) and add a Z axsis? Or will I have to use an extra module like PGReloaded, PyGame, etc. If so could someone give me a good place to learn the module. By the way the name of the game will be The Search. | false | 16,390,995 | 0 | 0 | 0 | 0 | No, Tkinter is not enough for making 3D games. | 0 | 1,469 | 0 | 0 | 2013-05-06T01:51:00.000 | python,module,pygame | 3 Dimensional Games in Python Modules | 0 | 1 | 3 | 16,391,007 | 1 |
0 | 0 | I work mostly with Matlab but I am little bit familiar with Python as well. I have never created a GUI before, however, I have been suggested to develop a GUI for an important project in Python and not in Matlab.
Considering this situation, are there any suggestions that you would like to give which could help me create GUI in python in a time period of a month? Also, I would like to know if I can use Python's Spyder IDE and create GUI from that platform? | false | 16,428,064 | 0.291313 | 0 | 0 | 3 | I would definitely vouch for wxpython. It's very good for advanced GUI work. | 1 | 25,474 | 0 | 4 | 2013-05-07T20:33:00.000 | python,matlab,user-interface,transitions | Creating Graphical User Interface (GUI) in Python | 0 | 1 | 2 | 16,455,768 | 1 |
0 | 0 | How to design such function that user can use mouse to draw a line to connect two shapes? I'm using this module in wxpython : wx.lib.ogl.
The doc for theses methods are brief and no good demo that I can learn from.
Does anyone can give me some ideas?
Thanks | false | 16,431,949 | 0.197375 | 0 | 0 | 1 | Did you look at the wxPython demo? It shows exactly how to do this. It draws several shapes and then connects them with arrows and lines. You can get the wxPython demo from the wxPython website, which I assume you already know since you keep re-posting your questions to the wxPython mailing list. | 0 | 150 | 0 | 0 | 2013-05-08T02:57:00.000 | connection,wxpython,draw,shapes | draw lines to connect two shapes | 0 | 1 | 1 | 16,444,284 | 1 |
0 | 0 | This is mostly for Py2app, but I plan to also port to Windows so Py2exe is also applicable.
For Mac: How can I access the Resources folder of my app bundle from Python code? The ideal way for me would be to get the path to this folder into a variable that my classes prepend to any file they need to access. Given the portable nature of OSX app bundles this Resources folder can move, so it's obviously not acceptable to assume it'll always be at /Applications/MyApp.app/Contents/Resources.
For development I can preset this variable to something like "./Resources-test" but for the final distribution I would need to be able to locate the Resources folder to access files therein as file objects.
For Windows: If I use py2exe, what's the correct way to get the path to where the application is running from? (Think portable app - the app might be running from Program files, or a directory on someone's flash drive, or in a temp directory!) On Windows it'd be suitable to simply know where the .exe file is and just have a Resources folder there. (I plan to make cross-platform apps using wxwidgets.)
Thanks | false | 16,434,632 | 0.664037 | 0 | 0 | 4 | By default the 'Resource' folder is current working directory for applications started by py2app.
Futhermore the environment variable "RESOURCEPATH" is set to the absolute path of the resource folder. | 0 | 1,524 | 1 | 5 | 2013-05-08T07:05:00.000 | python,resources,py2app | How to directly access a resource in a Py2app (or Py2exe) program? | 0 | 1 | 1 | 17,084,259 | 1 |
0 | 0 | I want a key press to be mapped with a button click function in Gtk-python, i.e. if Enter key is pressed, the data-process function should execute, which is called by pressing the process button.
Can this be done? | false | 16,485,470 | 0 | 0 | 0 | 0 | Assuming you are using a gtk.Entry() and a gtk.Button(), I think what you need to do is just connecting the gtk.Entry() to your data-process function like this:
b = gtk.Button("Process")
b.connect("clicked", data-process)
e = gtk.Entry()
e.connect("activate", data-process)
That should do the "Trick".
Hope this helped. | 0 | 1,088 | 0 | 0 | 2013-05-10T15:14:00.000 | python,button,gtk | Map a key press to a button click in Gtk Python | 0 | 1 | 2 | 33,197,888 | 1 |
0 | 0 | I've been experiencing a really weird bug recently:
Often when I zoom too much on a QGraphicsItem (using scale on the view containing it) that has a QGraphicsDropShadowEffect on it, my app closes with a segmentation fault (core dumped) error.
What's weird is that:
I use Python (with the PySide binding)
If I remove the QGraphicsDropShadowEffect, the bug disappears
I also had to remove the QGraphicsDropShadowEffect on a relatively big item because it got the app so slow to the point it became irresponsive when I zoomed a bit too much.
Do anyone know how I could fix this ? | false | 16,487,059 | 0 | 0 | 0 | 0 | This may or may not help but when I encountered this the only thing that helped was reinstalling/updating pyside. I thought the fixed that bug a while back however. | 0 | 150 | 0 | 2 | 2013-05-10T16:43:00.000 | python,qt,user-interface,pyside | Qt : Segfault when zooming on QGraphicsDropShadowEffect | 0 | 1 | 1 | 16,492,340 | 1 |
0 | 0 | I am designing a GUI with several components and two wx.Frame objects F1 and F2. F1 is the main frame and F2 is the secondary frame. I would like to have a mechanism, so the user can attach these two frames into one frame, and also detach them into two frames again if needed.
Assume F1 and F2 contain panels P1 and P2 respectively. When detached, the use should be able to move and resize each frame independently, and closing F1 will close the entire GUI. When attached, F1 will contain both P1 and P2 vertically and F2 will seem to vanish and become a part of F1. There is a lot of wiring and events and messages passed between P1 and P2 which should work in both attached and detached modes.
I have seen this effect in some modern GUI's, but I was unable to find a proper technique online to carry this out. What is a proper way to do this?
Thanks | false | 16,490,263 | 0 | 0 | 0 | 0 | I'm not sure you can move a wxPanel from a wxFrame to another on the fly on wx.
The main reason is that the panel is dependent of its parent and you can't change it on the fly.
Now if you really want to do it, you'll have to create copy the panel in the other frame and delete the previous panel and frame (or just hide them).
There's no built in copy but you can find a way to get the content of your original panel and copy it on the other one. | 0 | 829 | 0 | 2 | 2013-05-10T20:23:00.000 | python,user-interface,frame,wxwidgets | Attach/Detach two frames in wxpython | 0 | 1 | 3 | 16,537,239 | 1 |
0 | 0 | Got a QStandardItemModel on my QTableView and trying to remove all the rows in it.
I was first calling a method I created with a call to takeRow, which does not delete the object if I'm right.
What about removeRows from QAbstractItemModel? I've tried it, and as I had a signal on the model ( dataChanged ), it seems that the signal hasn't been disconnected cause I still have some error in the background like "Underlying C/C++ object has been deleted" when I try to delete, and then add some new rows.
Am I missing something here..? | false | 16,603,207 | 0 | 0 | 0 | 0 | Did you follow the advice on subclassing model classes? I only encountered such problems if I didn't followed the hints in the docs ;)
A removeRows() implementation must call beginRemoveRows() before the rows are removed from the data structure, and endRemoveRows() immediately afterwards. | 0 | 371 | 0 | 0 | 2013-05-17T06:56:00.000 | python,pyqt,qtableview,qstandarditemmodel | QStandardItemModel removeRows does not remove signals on cells? | 0 | 1 | 1 | 16,761,536 | 1 |
0 | 0 | I am just learning python as my first programming language, and I just installed python 3.3, 64 bit on my windows 7 OS.
I installed komodo edit 8.0, and I am trying to print ('Hello world'). I set up the correct path so that I can access python through my command prompt.
From komodo, I saved my helloworld.py file to my desktop.
When I try to run the command prompt, I search for the file, and it says file not found, or file does not exist. I can open the folder from komodo, but it appears that it is empty. When I open the folder directly from my desktop, I see the file is in there, so it seems that komodo is not recognizing it.
How can I get Komodo to recognize my saved file and run it in python? I am very new so please go step by step if you can.
Thank you! | false | 16,615,838 | 0 | 0 | 0 | 0 | Ok heres what I personally do.
Open run, type in cmd
Navigate to whatever directory my mypythonfile.py file is
Open whatever text editor you feel like ( personally i use notepad++ because it is NOT an IDE like kodomo, but just a pretty text editor.)
Type python mypythonfile.py and hit enter. This will run the program.
Open mypythonfile.py in text editor program.
Make changes to the python file.
Go back to the cmd window and press arrow up ( to go to the last typed command) and then press enter again, to run the program again.
Repeat steps 6-7 until your program is perfect.
It seems like you are having trouble with the Kodomo IDE instead of the actual learning python process. IDEs are complicated tools with lots of buttons that are scary. Learn the language first, then once you are comfortable there, then maybe you will use an IDE? Or maybe you will just keep using a text editor instead. Thats up to you. | 0 | 968 | 0 | 1 | 2013-05-17T18:40:00.000 | python,komodo | I need help recognizing files in komodo in order to run them in python | 0 | 1 | 2 | 16,616,493 | 1 |
0 | 0 | I'm learning the Python and now I'm trying to choose cross-platform-GUI-framework. As I see, the PyGTK is the best one, which fits my goals completely.
The only question: is there any analog of pyuic4 (which creates python class based on .ui file created by QtDesigner) for files made with Glade app? Or the only way is creating class manually? | true | 16,616,029 | 1.2 | 0 | 0 | 2 | The user interfaces create with glade are saved as xml file: using gtkbuilder, this file can be used with many programming languages, like c++ or python.
Pygtk lets you create application with user interfaces, based on glade file.But you have to do all by hand. | 0 | 2,653 | 0 | 3 | 2013-05-17T18:52:00.000 | python,gtk,pyqt,pygtk | How to convert .glade file to python class? | 0 | 1 | 3 | 16,616,290 | 1 |
0 | 0 | Can someone tell whether there is any application that converts a PyQt4 (with syntax in Python) project to a Qt4 (with syntax in C++) project?
This will help people to switch from using a GPL non-commercial license in case of PyQt to a much liberal LGPL non-commercial license in case of Qt! | true | 16,616,728 | 1.2 | 0 | 0 | 0 | Use PySide. It's about 99.8 % compatible with PyQt, except for Signals and Slots.
Replace every occurence of PyQt4 with PySide in your project, then replace pyqtSignal with Qt.Signal and pyqtSlot with Qt.Slot.
It should work out of the box.
Many projects support both PyQt and PySide because there is virtually no difference between the two… | 0 | 217 | 0 | 0 | 2013-05-17T19:43:00.000 | c++,python,qt,pyqt,pyqt4 | is there any application that converts a PyQt (with syntax in Python) project to a Qt (with syntax in C++ ) project? | 0 | 1 | 1 | 16,761,507 | 1 |
0 | 0 | I am trying to install wxpython onto my Mac OSX 10.8.3. I download the disk images from their downloads page and mount it. When I try to install the package I get an error that saying that the package is damaged and can't be opened. Any suggestions on how I can fix this?
I have also tried opening the package through the terminal but no luck.
Thanks in advance. | false | 16,638,977 | 1 | 0 | 0 | 8 | Go to System preferences --> Security and privacy --> Allow applications downloaded from..select 'Anywhere' | 0 | 7,577 | 1 | 6 | 2013-05-19T20:08:00.000 | python,macos,wxpython | Trying to install wxpython on Mac OSX | 0 | 1 | 3 | 20,097,953 | 1 |
0 | 0 | Started messing with Tkinter today, but when I tried to run my first program it crashed. It appears the reason is that I don't have Tkinter. This is a standard installation of Python 3.3 on Windows 7, why is it not there? How can I get it? | false | 16,639,752 | 0.132549 | 0 | 0 | 2 | Maybe you disabled it during Python installation? It is Tcl/Tk item in install wizard and it can be disabled. Try reinstall Python and do not turn it off. | 1 | 4,331 | 0 | 1 | 2013-05-19T21:41:00.000 | python,python-3.x,tkinter | Why is Tkinter missing? | 0 | 2 | 3 | 16,639,964 | 1 |
0 | 0 | Started messing with Tkinter today, but when I tried to run my first program it crashed. It appears the reason is that I don't have Tkinter. This is a standard installation of Python 3.3 on Windows 7, why is it not there? How can I get it? | true | 16,639,752 | 1.2 | 0 | 0 | 6 | This answer might be irrelevant with more information, but, for now: are you capitalizing "Tkinter" when using the import command? In Python 3.x, it's imported as lower-case ("import tkinter"), but in 2.x code it's imported with an initial capital ("import Tkinter"). | 1 | 4,331 | 0 | 1 | 2013-05-19T21:41:00.000 | python,python-3.x,tkinter | Why is Tkinter missing? | 0 | 2 | 3 | 16,639,892 | 1 |
0 | 0 | I've collected many nice wall papers over years.
I know python and c++ (a little MFC eperience).
I want to make a programme that can change my wallpapers.
I want to operate like this:
there is a little icon (half transparent), if i click it, it change my wallpapers to the next picture in my wallpaper collection folder.
I found many infos of changing wallpaper by programme by google.
But can't find out the win7 API for adding a button on desktop.
Please some one tell me how to set a icon-button on the desktop, or it's just there's no such API?
EDIT:
I just find that there are ways to make a window unmovable. So, I think now I need to find ways to make windows out of an icon. Then it'll looks like a button on desktop. And, there are ways to make windows taking some response when it's clicked(once), right?
Closure:
Captain's method may be a better way for people with good understanding of windows.
I know python, but few knowledge of MFC or similar framework with deep relations with the OS itself. This desktop button creation is very hard to implement for me.
Modifying christian's script and a windows shortcut would be a not-good-looking compromise. I'll do it this way. | false | 16,644,007 | -0.066568 | 0 | 0 | -1 | There is an easiest way.
Install VBest Icon groups. ( it is a desktop icon stack )
Then select any stack and add a single button. ( drag and drop any application will get its link and icon in the stack )
Select the stack and in its settings, set transparency equals 0 ( slide to left)
That is it. Now you have a single button with link. | 0 | 672 | 0 | 0 | 2013-05-20T06:45:00.000 | c++,python,windows,api | create an button on desktop | 0 | 1 | 3 | 66,233,621 | 1 |
0 | 0 | I've recently discovered IronPython in C# and only tutorials I found were how to use python script in C#, but I've noticed, that IronPython has classes and methods you can use directly in C# like : PythonIterTools.product some_pr = new PythonIterTools.product(); and others, can anyone explain how does this work? | true | 16,646,135 | 1.2 | 1 | 0 | 1 | Parts of IronPython's standard library are implemented in C#, mainly because the equivalents in CPython are written in C. You can access those parts directly from a C# (or any other static .NET language) directly, but they're not intended to be used that way and may not be easy to use. | 1 | 223 | 0 | 0 | 2013-05-20T09:11:00.000 | c#,ironpython | Using IronPython in C# | 0 | 1 | 1 | 16,652,356 | 1 |
0 | 0 | How can I add a
TextCtrl
area that will allow input only if a checkbox is ticked? Otherwise the TextCtrl area will be ignored. | false | 16,680,798 | 0.53705 | 0 | 0 | 3 | Bind an event handler for the checkbox widget that will call the textctrl's Enable method, passing True or False based on the status of the checkbox. | 0 | 42 | 0 | 0 | 2013-05-21T22:51:00.000 | python,wxpython | wxPython - Optional Text Boxes | 0 | 1 | 1 | 16,681,397 | 1 |
0 | 0 | I've spent literally all day on google, stackoverflow, and many other sites trying to find a way to implement a windowless app using python, to no avail. I'm familiar with python and have been using pygtk to create previous apps, but it doesn't look like pygtk can cut it.
I'm using the standard Ubuntu 12.10 Unity setup, and don't want to switch over to something that uses compiz. I also don't want to use screenlets.
The app I want to create is to notify me of any updates on my social media accounts, and I want it to be floating perpetually on the screen, accessible at any time. I want it to be stand-alone, and not be dependent on outside apps (like screenlets) to run, and I want it to be as minimalistic as possible.
If I can't accomplish this with pygtk, what else should I use? If it is possible, how would I go about implementing it? | false | 16,706,907 | 0 | 0 | 0 | 0 | BTW Unity is COMPIZ plugin :D
Also I think that PyGTK will not be able to do it. You'd need some kind of desktop plugin, but what are you trying to do is tricky, it may break in future versions of Unity - you need to use the desktop manager (wm) to manage that as a borderless window with static position, somethink like desktop plugins in KDE. Also it will not work in other wm's.
Maybe you should consider making it a simple icon in the notification area that would change and on hover it would display more info.. that I'm sure would work anywhere. | 0 | 336 | 0 | 0 | 2013-05-23T06:23:00.000 | python,ubuntu,user-interface,pygtk,desktop-application | How would I create a windowless app using python on Ubuntu 12.10? | 0 | 1 | 1 | 16,709,612 | 1 |
0 | 0 | I'm currently developing a small application in Python with the use of GTK+ (and Glade). Everything has been fairly simple to integrate so far, until I came up with the idea to add tabs instead of pop-ups. Note: Still using Python 2.7+
Is there any easy way to implement already existing pages inside a new tab(notebook) like structure? I'm having difficulties to find how to add content per separate tab created in glade.
Perhabs a more 'clear' question: What Notebook function will be required to call a specific V/HBox with every different tab? The current structure looks like (minus Menu / statusbar):
[ mainWindow ] --> (1) mainOverview (gtkVbox) --> (2A) mainContent (gtkHbox) ... other non-related content
The structure I was hoping for would look like:
[ mainWindow ] --> (1) mainOverview --> (2) noteBook --> (3) Tab1 --> (4) mainContent (gtkHbox) -- (3) Tab2 --> (4) secondaryContent (gtkHbox)
The application itself works fine (multithreaded, fully functioning) without the tabs, the mainContent(gtkHbox) contains a file/recursive directory analyzer, a few checkboxes and a general overview. I was hoping for an easy way to display this main window (the gtkHbox) ONLY when having Tab1 selected.
Having difficulties to find good reference pages that display a proper way to call content pages per notebook tab. Any reference-pages or useful links are very much appreciated! Thanks so far! My apologies if this is a rather newbish question, I'm not new to Python coding, but interfaces on the other hand... ;) | false | 16,744,702 | 0.099668 | 0 | 0 | 1 | Not an answer, but it looks like "another.anon.coward" already answered this in a comment...
If you double click on the tab, then that page is selected for adding content in glade. You can go ahead and add content for that page. As for switching you can use set_current_page to switch to page whose content you want to display. Register for "switch-page" signal to find out which page has been switched to. | 0 | 1,912 | 0 | 6 | 2013-05-24T22:57:00.000 | python,gtk,glade | Python GTK (Glade) Notebook | 0 | 1 | 2 | 22,049,793 | 1 |
0 | 0 | Is it possible for, in python + tkinter, to set a maximum number of characters per line in a label? I have a program that opens a Toplevel window with some information taken from other information the user gave in the past. It is unresizable, which is a probel because every now and then the window get's too small for the information, which is shown in labels, so I was wandering if I could set it to add a line break every 30 characters, for example.
I looked through some label documentation, but the only thing I found was the possibility to change the label's width, which is not what I need, since is basically hides every character after the 30th. | false | 16,761,726 | 0.197375 | 0 | 0 | 2 | The option you are looking for is wraplength, which sets when a label’s text should be wrapped into multiple lines. However, this parameter is given in screen units, while width is text units if the widget displays text (so you can't use 30 directly). | 0 | 1,975 | 0 | 2 | 2013-05-26T17:15:00.000 | python,string,tkinter,label | Label break line if string is too big | 0 | 1 | 2 | 16,761,818 | 1 |
0 | 0 | I am developing a game in Python and was wondering how to give it its own icon. I am using a windows computer and have no extra things installed with Python. Oh also I am using version 3.3 Is this even possible.
P.S I have found other things on Stack Overflow but they are using different Operating Systems like Ubuntu and Macintosh | false | 16,782,047 | 0 | 0 | 0 | 0 | You can't. In Windows, custom icons can only be assigned to certain types of files (executables and shortcuts, mostly), and Python scripts are not one of those types. | 1 | 40,170 | 0 | 7 | 2013-05-28T00:04:00.000 | python | How To Add An Icon Of My Own To A Python Program | 0 | 2 | 7 | 16,782,089 | 1 |
0 | 0 | I am developing a game in Python and was wondering how to give it its own icon. I am using a windows computer and have no extra things installed with Python. Oh also I am using version 3.3 Is this even possible.
P.S I have found other things on Stack Overflow but they are using different Operating Systems like Ubuntu and Macintosh | false | 16,782,047 | 0.057081 | 0 | 0 | 2 | If you are trying to change the icon of the shortcut for your program,
then you need to get to the file where ever it is right-click it and go to create a shortcut
then drag that shortcut to your desktop
then right-click that shortcut and click properties
then click on "Change Icon"
then go to where your desire .ico image is saved and set that as the icon
if you do this and you open your program in the corner will be the .ico you selected and on your desktop, it will show the icon instead of the python image.
that is how you change the shortcut icon but there is no way to change the actual window icon in the corner unless you're using something like Tk or Pygame. | 1 | 40,170 | 0 | 7 | 2013-05-28T00:04:00.000 | python | How To Add An Icon Of My Own To A Python Program | 0 | 2 | 7 | 16,782,121 | 1 |
0 | 0 | I made a 2D project with a lot of tile sprites, and one player sprite. I'm trying to get the camera to follow the player, and for the most part it's working. However, there's one problem:
If you go to the edge of the map, it scrolls normally, but instead of the black background, it displays copies of the sprites on the edge of the map instead of the background (black). It has the same problem if I leave some squares empty, when I move it displays a copy of the tile that was previously there.
The camera works like this:
Select sprites that should be visible
Do sprite.visible = 1 for them, and sprite.visible = 0 for all other sprites
Set the position sprite.rect of all sprites to coords - offset
Update the screen (I use flip(), because the camera moves every turn, so the whole screen has to be updated every turn)
All DirtySprites have dirty = 2.
Does anyone know why it's displaying copies of the sprites on the edge instead of the background?
Help would be appreciated! | true | 16,794,333 | 1.2 | 0 | 0 | 1 | Unless you manually clear your screen surface, flip will not change its content.
Thus, if you neglect to draw to a certain location, it will remain the same.
If you want to get rid of this effect, usually called "hall of mirrors", you will have to keep track of what portions of the screen have not been drawn to yet and draw over these yourself.
It may be easier to define background sprites around your map's contours and block your camera from going off too far.
Since you use a "dirty/clean" approach to only redrawing what's changed, you won't have the option to just fill the whole screen surface before you draw your frame, because that would draw over anything that's stayed the same since the last frame. | 0 | 86 | 0 | 0 | 2013-05-28T14:13:00.000 | python,pygame,sprite,rect | (pygame) Empty squares displaying copies of what was previously there instead of background | 0 | 1 | 1 | 16,797,483 | 1 |
0 | 0 | I am working on a project in eclipse, i have been working for the last few months in python/pygame, making pygames in the Python IDLE. I have my eclipse build setup with android sdk and pydev to run python programs (pygame) in eclipse. What I am trying to do is build an app with the android sdk that can use my pygame inside the app (put game built in pygame on android app through android sdk) that way the main menu would be coded in java with buttons, etc, then when you click the play button it goes to the pygame code. Is there anyway of doing this, you can make individual projects of the 2, and make an android app, but I want to integrate both languages features for the best performance. How am I going to do this???? I have looked on the web and I can't find anybody talking about doing this, it may be impossible, maybe not. Is it possible for this to be done for an app in eclipse???? | false | 16,803,826 | 0 | 0 | 0 | 0 | No, there's really no way of doing this. Pygame is not natively runnable on Android: you'd need to somehow find a Pygame port to Jython and then figure out how to make that work using the Android drawing primitives. Probably more work than it is worth. | 0 | 418 | 0 | 0 | 2013-05-29T00:55:00.000 | android,python,eclipse,pygame,pydev | How do you integrate PyGame and Android SDK together inside Eclipse to build an Android App running Java SDK as the main menu for PyGame? | 0 | 1 | 1 | 16,803,982 | 1 |
0 | 0 | I have used cx_freeze several times in my windows 7 and I had never any problem with it but now I want to run the executable produced by cx_freeze in a Windows XP.
But when I run the program I get this error:
the application configuration is incorrect. Reinstalling this application may fix this problem
I have searched for info about this problem and it seems to be the that the Microsoft Visual Studio 2008 redistributable is not intstalled. I am going to launch this executable in many computers so I don't want to install absolutelly nothing in the system.
I have read that I can just place those 4 files in the same folder than my binary is:
Those 3 from this directory
C:\WINDOWS\WinSxS\x86_Microsoft.VC90.CRT_1fc8b3b9a1e18e3b_9.0.21022.8_x-ww_d08d0375
msvcm90.dll msvcp90.dll msvcr90.dll
And this file from this directory
C:\WINDOWS\WinSxS\Manifests
x86_Microsoft.VC90.CRT_1fc8b3b9a1e18e3b_9.0.21022.8_x-ww_d08d0375.manifest
I have search this direcories in my system (Win 8) and they are not with this exactly folder. Anyway I downloaded them from internet and try it but it did not work
I have Python 2.7 and cx_Freeze-4.3.1
I have read that if I use a lower version of pyython it could works. It is true? Why?
Do you know hoy can I solve it without installing anything in the system?
Thank you very much for your help. | true | 16,804,806 | 1.2 | 0 | 0 | 3 | Thank you eveyone for your help. I finally get it working with a different solution.
I found other programs in my system that has this dlls too. Eclipese was one of them (in this path:
eclipse\plugins\com.intland.hgbinary.win32_2.3.2\os\win32
)so I just took:
Microsoft.VC90.CRT.manifest
msvcm90.dll
msvcp90.dll
msvcr90.dll
this files and copy and paste them to the folder of my compiled python code. And it works like magic.
Thank you anyway for your help!! :D | 1 | 1,636 | 0 | 6 | 2013-05-29T03:04:00.000 | python,windows-xp,cx-freeze | Python Cx_Freeze error in Windows XP | 0 | 1 | 1 | 16,848,122 | 1 |
0 | 0 | i need to use select() on a bool because the module pygame.midi lets you know when a midi message is ready only through the function Input.poll() that returns a bool.
if i check this value in the simple way, i do busy waiting and my cpu works at 100% all the time.
is there a way to use the select() or similar functions to wait for a variable to change its value in a context without automatic event raising?
(i don't strictly need to live eventless, indeed i would love to use them, but i can't see midi events anywhere in the package..) | true | 16,822,338 | 1.2 | 0 | 0 | 2 | When developing games you usually do everything in a main loop. If you want e.g. 50 fps, then you want to go through this loop 50x per second. If you assume that you are not doing anything time consuming, then you can sleep for 20ms at the end of every iteration.
So I think that's the reason why only poll is available, you are supposed to check whether the midi is loaded in your loop. If it is, then you can do something with it, otherwise you would continue rendering or doing something else. Generally while creating games and apps that should have consistent fps, you don't want to wait for some event. | 1 | 364 | 0 | 0 | 2013-05-29T19:31:00.000 | python,select,boolean,pygame,midi | python - select() on boolean variable | 0 | 2 | 2 | 16,822,525 | 1 |
0 | 0 | i need to use select() on a bool because the module pygame.midi lets you know when a midi message is ready only through the function Input.poll() that returns a bool.
if i check this value in the simple way, i do busy waiting and my cpu works at 100% all the time.
is there a way to use the select() or similar functions to wait for a variable to change its value in a context without automatic event raising?
(i don't strictly need to live eventless, indeed i would love to use them, but i can't see midi events anywhere in the package..) | false | 16,822,338 | 0 | 0 | 0 | 0 | If your input doesn't have any way to fire events, you have to check it on a timer.
In most games, your main event loop already has some "frame limiter" code, so the event loop runs no more than 50 times/sec. So, you can just poll once per event loop. If not, you'll essentially have to add a frame limiter now.
If your game for some reason doesn't fit this paradigm—or if you need to poll the input much more often than your max frame rate—you have to write a background thread that reads from the input (blocking if possible, polling and sleeping if not) and either handles the events directly, or pushes then onto a queue that the main thread can read from each time through the loop. | 1 | 364 | 0 | 0 | 2013-05-29T19:31:00.000 | python,select,boolean,pygame,midi | python - select() on boolean variable | 0 | 2 | 2 | 16,822,580 | 1 |
0 | 0 | So, I am actually trying to restart a frame. I have my frame defined in my mainF.py file, and my panels defined as classes in a panels.py file. I call these two methods when my clear button is pressed:
self.frame.Destroy()
main()
where main() is my method for jumpstarting my frame object.
In my mainF file, I am using this statement
from panels import *
and in my panels file, I have tried
import mainF and
from panels import *
However, I always receive NameError: Panel1 is not defined.
This is confusing me since I do define it in my import statements, and the programs executes main() the first time through without this error. When I had all classes defined in one file, I never received this error. Any help would be appreciated, thanks. | false | 16,825,742 | 0 | 0 | 0 | 0 | It's probably due to circular imports. One file is not yet fully imported when it imports another, which then imports the first one again. Since it was already started the original module object is returned, but it hasn't yet defined the class you are looking for. | 0 | 173 | 0 | 0 | 2013-05-29T23:47:00.000 | wxpython | wxpython global name not defined error | 0 | 1 | 1 | 16,826,193 | 1 |
0 | 0 | I would like to display a file having Unicode data (Malayalam) in a window with a scrolled area, with all the named entities in different colours in tkinter (PYTHON).
For example, consider the sentence - 'Python is a programming language.'
In my window, Python should be in a different colour. My file contains more than 100 lines. So I need the display in a scrolled area and text in it having different colours.
Thanks in advance for your help. | true | 16,829,049 | 1.2 | 0 | 0 | 1 | You will want to use the text widget. To color certain words or characters you will need to define a tag, and apply that tag to a range of text. | 0 | 65 | 0 | 0 | 2013-05-30T06:05:00.000 | python,tkinter | How to display unicode data in a file with named entities in different colours in a popup window with scrolled area in tkinter? | 0 | 1 | 1 | 16,834,234 | 1 |
0 | 0 | If I'm using an image and I want to know the image's size in the file.
There is a function to get the picture's height and width ?
EDIT: Of course I loaded the image to the program with pygame.image.load(PATH). | false | 16,840,711 | 0.099668 | 0 | 0 | 1 | I believe you need to load the image as a Surface before you can get its width and height. You do that with foo = pygame.image.load(PATHNAME).
Then you can get the width and height by creating a Rectangle with foo.get_rect() and asking the rectangle. | 1 | 3,476 | 0 | 1 | 2013-05-30T15:55:00.000 | python,image,pygame | How to get the picture size in pygame (python) | 0 | 1 | 2 | 16,841,217 | 1 |
0 | 0 | I have an Android application that captures an image and Python code that extracts some features from images. I want to connect them to each other (receive the image in Python from the Android application). I read some things about building a TCP Server, but I don't know how to do it and how to start as it's my first time to do something like that.
Can anyone help? | false | 16,846,967 | 0.099668 | 0 | 0 | 1 | Well, you could have the Android Application save the image to a folder and have the Python file import that image. | 0 | 653 | 0 | 1 | 2013-05-30T22:37:00.000 | android,python,sockets,tcp | Connect Android to Python | 0 | 2 | 2 | 16,847,185 | 1 |
0 | 0 | I have an Android application that captures an image and Python code that extracts some features from images. I want to connect them to each other (receive the image in Python from the Android application). I read some things about building a TCP Server, but I don't know how to do it and how to start as it's my first time to do something like that.
Can anyone help? | false | 16,846,967 | -0.099668 | 0 | 0 | -1 | You can upload a image to server using any of the database, use python code on server side and you will get the result. | 0 | 653 | 0 | 1 | 2013-05-30T22:37:00.000 | android,python,sockets,tcp | Connect Android to Python | 0 | 2 | 2 | 36,057,987 | 1 |
0 | 0 | In your opinion, what is the best way to create gui in Windows with python ?
Do you recommend PyQt for windows? | false | 16,848,912 | 0.099668 | 0 | 0 | 1 | I prefer PyQt, there is some examples in the pyqt release directory, you can try it out. I think the effect is really cool.
I haven't tried other library so i could not compare PyQt with others . As I am familiar with Qt, the coding experience is very easy if you switch Qt to PyQt. | 0 | 5,220 | 0 | 1 | 2013-05-31T02:34:00.000 | python,windows,qt,gtk,pyqt | Your best library for create GUI with Python (PyQt, PyGTK, wxPython, IronPython, etc) | 0 | 1 | 2 | 16,854,156 | 1 |
0 | 0 | I want to use pygtk app for android app development. I want to use app like pygtk which will have easy drag and drop options for developing the front end for android application.
Is there any of such thing which can let me design my front end for android app with drag and drop? (specially in python or else in java) | false | 16,869,621 | 0.379949 | 0 | 0 | 2 | I see you tagged the question with kivy, I can only answer that we don't have such a thing for kivy yet, although a GSOC student got accepted for this and will start working on it soon, let's hope it'll work out nicely :). I'm of the opinion that the kvlang we have in kivy makes the need of a Graphical Designer far less than in other toolkits, but i guess YMMMV.
Other than that, I don't think you can do PyGTK development on Android currently, but I think PySide works, so maybe QtDesigner or some other Qt design application would be worth a look? | 0 | 1,574 | 0 | 3 | 2013-06-01T06:00:00.000 | java,android,python,pygtk,kivy | use pygtk for android apps development | 0 | 1 | 1 | 16,878,423 | 1 |
0 | 0 | I use intellij idea plug in for python developing. I want to import pygame module to my project, but everytime I get error "ImportError: No module named 'pygame'". I tried to add the pygame lib folder to dependencies but it didn't work, I also added it to library but it didn't work either. Could anyone help me with this issue.
Thanks | false | 16,874,716 | 0 | 0 | 0 | 0 | you can try to install the pygame lib to your python directory, but you might have to make your python 32 bit for that to work dunno how it works on windows. On mac though there are several tutorials. | 0 | 1,211 | 0 | 3 | 2013-06-01T16:22:00.000 | python,import,intellij-idea,pygame | importing pygame in Intellij IDEA | 0 | 1 | 1 | 32,979,653 | 1 |
0 | 0 | Im running Mac OS 10.8.3 and python/idle 2.7.5.
I tried to install pygame 1.9.1 but it didnt work. Is this the right pygame? if not which is? | true | 16,899,170 | 1.2 | 0 | 0 | 1 | I solved it. I installed "Lion apple supplied python: pygame-1.9.2pre-py2.7-macosx10.7.mpkg.zip"
Then i went into terminal and tried to import pygame through Aplle python and it prompted me to install "Xquartz" after i did this pygame works in both Terminal and 64 bit Idle 2.7.5. | 1 | 356 | 0 | 0 | 2013-06-03T14:30:00.000 | python,installation,version,pygame | Which pygame should i install? | 0 | 1 | 2 | 16,899,819 | 1 |
0 | 0 | I have made an object controlled with arrow keys. When I move it to the edge of the pygame screen, the object moves off the screen. I was wondering how to keep the object on the screen. Any suggestions? | false | 16,952,059 | 0.066568 | 0 | 0 | 1 | On each handle of the input, check if the object's target x position plus its width exceeds the width of the canvas or if it is less than 0. Deny the movement if so.
Repeat for the y coordinate and the height. | 0 | 364 | 0 | 0 | 2013-06-06T00:47:00.000 | python,pygame | In pygame how to make an object controlled with arrow keys not move of the edge of the screen | 0 | 1 | 3 | 16,952,066 | 1 |
0 | 0 | I have a C++ GUI, it load a DLL when running. I use SIP to import the DLL in python. I need to embed the python part in the GUI, and some data are needed to exchange between python and C++.
For example, in the C++ GUI, I can enter command from a panel, such as "drawSomething()", it will call corresponding function in python, and the result will be shown in the GUI.
Can I use SIP to
extract a C++ object from python object (just like the way boost.python does), or is there a better way to share data between python and c++ seamlessly?
thanks. | true | 16,952,350 | 1.2 | 0 | 0 | 0 | It turns out that I do not need to do anything complicated...
In my case, there is no difference to call functions in DLL from C++ or from python code embedded in C++.
I am totally over-thinked. | 0 | 447 | 0 | 0 | 2013-06-06T01:28:00.000 | c++,python,python-sip | python-sip: How to access a DLL from both Python and C++ | 0 | 1 | 2 | 16,976,040 | 1 |
0 | 0 | I am planning to implement, as an exercise and for personal use, in a very relaxed pace, a GPS/Mapping/Cycling desktop application, with Python as the primary language. It must be cross-platform (windows and linux), and the graphical front-end should allow the following:
Relatively fast rendering of map tiles à la Google Maps, Bing Maps, etc. with panning, zooming, overlay, image-blending, etc.
Good support for retained-mode 2D graphics (routes, points) with direct manipulation, hit-testing, highlighting, selection, etc;
Good integration with multithreaded architecture (no UI freeze while performing calculations;
Preferrably good support to events-based communication between application code and GUI code;
Preferrably some support to 3D rendering with OpenGL or similar.
I have some experience with GTK, but I feel it too low-level, so I'm wondering if wxWidgets could be a good alternative IN THIS SCENARIO (rich graphics as a main requirement of the UI).
Any | false | 16,968,889 | 0.197375 | 0 | 0 | 1 | wxWidgets probably won't help you a lot here. I.e. you should be able to do what you want with it but you will need to implement most of your bullet points yourself. E.g. drawing would almost certainly be done using OpenGL but using OpenGL in a wxWidgets application is exactly the same as using it anywhere else. And you will have to implement panning/zooming/hit-testing.
wxWidgets does provide decent multi-threading support for the typical background-worker-threads-one-main-GUI-thread scenario that you would be almost certainly using here too. And simple communications between the threads (although I'm speaking about C++ here, not sure how is it done on Python side). But then any other decent framework should provide this too... | 0 | 283 | 0 | 0 | 2013-06-06T17:53:00.000 | python,user-interface,graphics,gtk,wxwidgets | Cross platform, python based, rich-graphics application for mapping and gps: GTK or wxWidgets? | 0 | 1 | 1 | 16,970,638 | 1 |
0 | 0 | I wrote a code to pop up a window on my screen and to print a data on the window.Here according to my requirement i want the entire screen to be BLACK in color. SO that i can print some text on that black window. The window title bar tkinter should be removed and the entire window screen should be in black. | true | 16,982,300 | 1.2 | 0 | 0 | 1 | Try self.configure(background='black') or self['bg'] = 'black'. Most Tkinter widgets can be configured with similar properties. | 1 | 875 | 0 | 0 | 2013-06-07T10:49:00.000 | python-2.7,tkinter | python:window with no title bar, and change window default color(grey) to black | 0 | 1 | 2 | 16,991,920 | 1 |
0 | 0 | I installed pyqt4 by using Homebrew. But when I import PyQt4 in python interpreter, It said that "No module named PyQt4". Can somebody help me with that? | false | 16,994,232 | 1 | 0 | 0 | 23 | After brew install pyqt, you can brew test pyqt which will use the python you have got in your PATH in oder to do the test (show a Qt window).
For non-brewed Python, you'll have to set your PYTHONPATH as brew info pyqt will tell.
Sometimes it is necessary to open a new shell or tap in order to use the freshly brewed binaries.
I frequently check these issues by printing the sys.path from inside of python:
python -c "import sys; print(sys.path)"
The $(brew --prefix)/lib/pythonX.Y/site-packages have to be in the sys.path in order to be able to import stuff. As said, for brewed python, this is default but for any other python, you will have to set the PYTHONPATH. | 1 | 122,359 | 0 | 27 | 2013-06-07T23:11:00.000 | python,pyqt4,homebrew | ImportError: No module named PyQt4 | 0 | 4 | 5 | 17,066,007 | 1 |
0 | 0 | I installed pyqt4 by using Homebrew. But when I import PyQt4 in python interpreter, It said that "No module named PyQt4". Can somebody help me with that? | false | 16,994,232 | 0.197375 | 0 | 0 | 5 | I solved the same problem for my own program by installing python3-pyqt4.
I'm not using Python 3 but it still helped. | 1 | 122,359 | 0 | 27 | 2013-06-07T23:11:00.000 | python,pyqt4,homebrew | ImportError: No module named PyQt4 | 0 | 4 | 5 | 39,129,422 | 1 |
0 | 0 | I installed pyqt4 by using Homebrew. But when I import PyQt4 in python interpreter, It said that "No module named PyQt4". Can somebody help me with that? | false | 16,994,232 | 1 | 0 | 0 | 14 | You have to check which Python you are using. I had the same problem because the Python I was using was not the same one that brew was using. In your command line:
which python
output: /usr/bin/python
which brew
output: /usr/local/bin/brew //so they are different
cd /usr/local/lib/python2.7/site-packages
ls //you can see PyQt4 and sip are here
Now you need to add usr/local/lib/python2.7/site-packages to your python path.
open ~/.bash_profile //you will open your bash_profile file in your editor
Add 'export PYTHONPATH=/usr/local/lib/python2.7/site-packages:$PYTHONPATH' to your bash file and save it
Close your terminal and restart it to reload the shell
python
import PyQt4 // it is ok now | 1 | 122,359 | 0 | 27 | 2013-06-07T23:11:00.000 | python,pyqt4,homebrew | ImportError: No module named PyQt4 | 0 | 4 | 5 | 37,955,316 | 1 |
0 | 0 | I installed pyqt4 by using Homebrew. But when I import PyQt4 in python interpreter, It said that "No module named PyQt4". Can somebody help me with that? | false | 16,994,232 | 0.158649 | 0 | 0 | 4 | It is likely that you are running the python executable from /usr/bin (Apple version) instead of /usr/loca/bin (Brew version)
You can either
a) check your PATH variable
or
b) run brew doctor
or
c) run which python
to check if it is the case. | 1 | 122,359 | 0 | 27 | 2013-06-07T23:11:00.000 | python,pyqt4,homebrew | ImportError: No module named PyQt4 | 0 | 4 | 5 | 16,994,978 | 1 |
0 | 0 | If I want to craw a circle, I use the regualr draw.circle but the problem is that I don't want it filled so I draw a smaller circle inside of it, it makes a circle with thickness.
Everything is good right? no. The background image inside that circle disappeared because the circles are filled.
Now my question is: There is a function that draws a circle (and other shapes[?]) that gets thick and not filling the whole inside of the shape?
EDIT: If you can give me the signature so I know how to use it. | true | 16,994,243 | 1.2 | 0 | 0 | 5 | The command is pygame.draw.circle(Surface, color, pos, radius, width=0). The last argument of width can be changed to not fill the circle in. If it is zero, the circle is solid and if it is anything else it is with an edge thickness of whatever the parameter is. | 1 | 9,645 | 0 | 1 | 2013-06-07T23:13:00.000 | python,pygame,draw | pygame not filled shapes (Python) | 0 | 1 | 1 | 17,000,916 | 1 |
0 | 0 | I have a ListCtrl and i wish to add the new rows to the top of the list (prior rows to be pushed down)
can you help me on that?
Thanks! | false | 17,029,608 | 0.099668 | 0 | 0 | 1 | I don't believe there is a built-in method to accomplish this. You would have to save the data, clear the control and then insert the new row or rows followed by the original rows. Personally, I would switch to using the ObjectListView widget where you can use lists of objects. Then you could just insert an object into the list and reset the control. | 0 | 981 | 0 | 0 | 2013-06-10T17:31:00.000 | wxpython,listctrl | WxPython, ListCtrl add rows to the top | 0 | 1 | 2 | 17,091,808 | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.