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
With QPython on Kindle fire .. I use QEdit to write & save a .py file .. say bob.py .. But when I switch to Console, I can't IMPORT from bob .. Can someone tell me how to do this? John (new to QPython)
false
27,193,835
0
1
0
0
I think you can save the module file into the same directory which you script locates or /sdcard/com.hipipal.qpyplus/lib/python2.7/site-packages/
0
1,136
0
0
2014-11-28T17:56:00.000
qpython
How to import from saved QPython file?
0
2
2
27,209,867
1
0
0
I'm trying to implement syntax highlighting for text in a Text widget. I use an external library to lexically analyse the text and give me the tokenised text. After that I go over all the words in the text and apply tag to their position in the text widget so that I can style each word. My concern now is how do I deal with changes. Every time the user presses a key, do I tokenise the entire text again and add style tags to the text widget for the entire text. This is proving to be quite slow. I then transitioned to only doing the highlighting process for the line the insert character was to make it faster but this is giving faulty results and the highlighting is not perfect now. What would be an ideal compromise between fast and perfect? What is the best way to do this?
false
27,207,643
0.197375
0
0
1
One possible answer is to do something like Idle does. As a user hits each key, its custom incremental parser tags identifiers that are a keyword, builtin, or def/class name*. It also tags delimited char sequences that are a string or comment. I does what can be done quickly enough. For example, if one types printer not in a string or comment, Idle checks if the word is a keyword or builtin name after each key. After t is hit, print is tagged. After e (or any other identifier char) is entered, printe is untagged. I believe some of the code is in idlelib/Hyperparser.py and some in ColorDelegator.py. You are free to copy and adapt code, but please do not use it directly, as the API may change. I presume the parser does the minimum needed according to the current state (after def/class, in an identifier, comment, string, etc.) Idle has an re-based function to retag the entire file. I 'think' this is separate from the incremental colorizer, but I have not read all the relevant code. If one edits a long enough file, such as idlelib/EditorWindow.py (about 3000 lines), and changes font size, Idle retags the file (I am not sure why). There is a noticeable delay between the file turning all black and its being recolorized. You definitely would not want that delay with each keystroke. Class/functions names with non-ascii chars are not yet properly recognized in 3.x, but should be. The patch is stuck on deciding the faster accurate method. Recognizing an ascii-only (2.x) indentifier is trivial by comparison. PS I am correctly in guessing that you are interested in tagging something other than Python code?
0
228
0
0
2014-11-29T22:02:00.000
python,performance,tkinter,syntax-highlighting,lexical-analysis
Efficiently applying text widget tags in tkinter text widgets
0
1
1
27,210,959
1
1
0
I want to debug separate pieces of my application in Visual Studio 2012. I have C# executable which works with Oracle.DataAccess dll. It works fine. Within it IronPython runtime is invoked and it works fine too. Within these IronPython modules object from main C# application is invoked and it works fine with Oracle dll. If IronPython script is invoked standalone then it works fine and uses C# object fine as well. However in this case C# object doesn't see Oracle dll. To debug IronPython scripts I have to create separate Python solution so I cannot configure my C# solution. So I do not have control of C# references. GAC has right Oracle dll but how to tell C# dll to use it? Vise versa if I'm in C# solution where I can manage the references then I cannot add py files and debug them. In what way can I configure VS to be able to run/debug my application with dual entry C# or IronPython separately?
true
27,208,926
1.2
0
0
1
You can try replicating what "works for me". Create a solution containing: python project (ironpython) C# project Add a reference to desired oracle library (Oracle.DataAccess.dll) to C# project using the standard VS mechanism. C# project should also contains a post build step to copy the resulting dll and pdb into the place where python script can find it. In my case root of the python project. Your python project is selected as Startup Project. I use Ctrl-F5 and F5 to start it. In both cases things work as expected. In debug mode I am able to set and hit breakpoint in python and in referenced C# module. I can see the oracle library being loaded (Output window of debugger). However: The stack traces are C# only. Visual Studio 2013 Update 4 together with PTVS 2.1 crashes on occasions when debugging.
0
390
0
0
2014-11-30T01:01:00.000
c#,.net,dll,ironpython
DLL loading (C#/IronPython/C#) in VS2012
0
1
1
27,233,826
1
0
0
I don't find how to force the window size with the kivy language. (ex: 800x600p) Can you help me ? Thanks for reading. PITO2901
false
27,234,386
0.197375
0
0
2
Set kivy.core.window.Window.size to (800, 600). You can't set it directly in kv, but you could bind it to a button or similar. You would also need to import the Window to kv, using the #:import statement explained in the doc.
0
1,505
0
1
2014-12-01T18:02:00.000
python,kivy
Force Window Size Kivy
0
1
2
27,235,194
1
0
0
I have a QGraphicsView in a QTabWidget with its tabs on the left. I want to move the location of the vertical scrollbar of my QGraphicsView to the left side, directly underneath the tabs. Is this possible?
true
27,243,455
1.2
0
0
0
I found I can do this by creating separate QTabBar and QScrollBar widgets that are attached to a QTabWidget and QAbstractScrollArea (I'm using a QListWidget now but I'm sure it'll work for QGraphicsView too) and then putting those widgets in a QVBoxLayout, and then putting the QVBoxLayout next to the QTabWidget/QAbstractScrollArea via a QHBoxLayout.
0
476
0
0
2014-12-02T06:48:00.000
python,layout,pyqt,scrollbar
PyQt move vertical scrollbar location in QGraphicsView
0
1
2
30,058,134
1
0
0
I'd like to add a feature where a user can record a video of the game that they're playing. How do I do this?
false
27,264,051
0.379949
0
0
2
I have not implemented the solution to this particular problem personally, but I will try to suggest one. Of course any of the solutions will slow down your programm cardinally, but technically it is possible. So what is probably worth trying, that you could use pygame.image.tostring() on you current frame, then just write (append) every frame to a file. So that will be actually your video in a raw format. Now if you want some particular video format, you should just convert it, best way is to use ffmpeg (you can call it before game exit with certain parameters from your game with subprocess.Popen("ffmpeg ...")). The only problem here is that the user, who want to record in such a way, must have ffmpeg installed in the system, so that ffmpeg is callable from the shell commandline. Advantage of this approach - it should be quite fast and does not use much extra memory, since you encode only once (for example when the user stops recording or exits the game) from the binary stream. Edit: that is just a broad description, of course you should find out also the wright parameters for ffmpeg, such as frame count, size and so on, and of course delete the raw data, since it can be really big file.
0
2,016
0
7
2014-12-03T05:06:00.000
python,python-3.x,tkinter,pygame
How do you record a "game" (PyGame or Tk) into a video?
0
1
1
27,306,611
1
0
0
I know this is possible to do using additional libraries such as win32com or python-pptx, but I wasn wondering if anyone knew of a way to insert an image into a powerpoint slide using the standard libraries. Lots of googling has indicated that the best solution is probably win32com, but since I can guarantee that every system this script will be deployed to will have win32com, I am looking for an implemention leveraging libraries all systems with a standard python 2.7 install will have.
true
27,297,668
1.2
0
0
0
It is probably possible to modify a .pptx file with the standard library without much effort: these new generation of files are meant to be zip-compressed XML + external images files, and can be handled by ziplib and standard xml parsers. Legacy .ppt files however are a binary closed format, with little documentation, and hundrededs of corner cases. It would alwasys "be possible" to change them, since they are still just bytes, but it would take considerable effort. That said, starting with Python 3.4, the Python installer "PIP" comes default with the language install: probably the best way to go would be to script the installation of external libraries based on the built-in PIP - that way one would not have to all external library usage.
0
507
0
0
2014-12-04T15:24:00.000
python,powerpoint
Insert Image into PPT using Standard Libraries
0
1
1
27,297,868
1
0
0
I am binding to ListBoxSelect and i want to implement a function which recognizes an alphabetical key-press and uses this to jump to the corresponding place in an alphabetically sorted list. Is there a way to tell what type of event is flagged by ListBoxSelect? I see something in the documentation about getting event "keysym" but i dont know how to access this.
true
27,304,973
1.2
0
0
0
No, there isn't a way to tell what type of event is flagged by <<ListboxSelect>>. Using <<ListboxSelect>> is useless for binding to a letter key, however. It only will fire for mouse clicks and using the arrow keys to navigate the listbox. You can bind to <KeyPress>. That binding will tell you what key was pressed, and in that binding you can change the widget's selection. You can get that information from event.keysym
0
47
0
0
2014-12-04T22:01:00.000
python,tkinter
How to determine the type of event flagged by <> in Tkinter?
0
1
1
27,305,312
1
0
0
I want to move the coordinates on a tkinter canvas so that the bottom left corner is (0, 0), meaning that the top right corner is (height, width). How would I do this?
false
27,323,228
0
0
0
0
You can't. You'll have to do math on all of your coordinates to translate them from one coordinate system to another.
0
85
0
0
2014-12-05T19:25:00.000
python,python-2.7,tkinter,tkinter-canvas
Move base coordinates Tkinter
0
2
2
27,324,242
1
0
0
I want to move the coordinates on a tkinter canvas so that the bottom left corner is (0, 0), meaning that the top right corner is (height, width). How would I do this?
true
27,323,228
1.2
0
0
0
Simplest way is to write a function that inverts your vertical coordinate, given the canvas height and desired element height passed in.
0
85
0
0
2014-12-05T19:25:00.000
python,python-2.7,tkinter,tkinter-canvas
Move base coordinates Tkinter
0
2
2
27,323,269
1
0
0
So I'm trying to figure out how to make a bullet class move from character to mouse click and if it hits a monster it will do damage to a monster. I've figured out how to calculate the mouse position and character position. It has been a while since ive been in a math class. i'm using pygame, python 3.4
false
27,332,961
0
0
0
0
A possible solution could be to find the slope of the line between the point of origin(where you are shooting the bullet from) and the location of the mouse click. If you are storing the bullet's x and y values you can then use the slope to change those values every clock tick depending on the speed of the bullet or however you've got it working. Ex. If the slope of the line is 2/5, every tick you change the bullet's y by 2 and the bullet's x by 5. I think this may work, or at least may be close to what you are looking for.
0
276
0
0
2014-12-06T15:01:00.000
python,pygame,mouse
Python, Shooting from Character Position to Mouse position on Mouseclick
0
1
1
28,238,371
1
0
0
Is there a tool that creates installers from the source code of a Kivy game for all the different supported platforms with a single button press? Linux: .deb, .rpm or just a portable .zip file that contains a .sh script Windows: .exe (installer or portable executable) Mac: .app (installer or portable executable) and possibly Android and iOS If not, is it possible?
true
27,347,356
1.2
0
0
2
All are possible, but I'm not sure what people are recommending right now - the Kivy website has instructions for pyinstaller (specifically on windows as I remember, but it works well on other platforms too), with the disadvantage that pyinstaller only supports python2 right now. You can use other tools too, I've seen some activity with e.g. nuitka, but I don't know the current state. Your best bet may be to ask on the kivy mailing list or irc, where some of the people using these tools are most likely to be around to comment. I haven't seen anyone do .deb or .rpm. I'm fairly sure it shouldn't be too hard, though you'd need to do some stuff yourself to make it work since you'd quite likely be forging new ground. Android and iOS are covered only by kivy's own build tools. These are fine on android, I can't comment on iOS.
0
464
1
3
2014-12-07T20:20:00.000
python,python-3.x,packaging,kivy
Creating installers or executables on Linux for every supported platform for a Kivy game
0
1
1
27,349,249
1
0
0
I made a Python game using Pygame. I try to make it so when it starts, it loads the shell, and entering a raw input would display the pygame window and start the game so that I can make the game playable without having to close the shell. It works, however, the window starts minimized. The game is a simple "dodge the object" and has no pause what so ever. The game still runs in the background, possibly having the player hit multiple projectiles before the user realizes it. Is there a way to focus on the window?
false
27,351,387
0
0
0
0
As I understood you, you don't want the game to start, before the window is in fullscreen-mode, right? When I try you attempt (starting through rawinput), my display is fullscreen from the start. Have you set everything correctly? I suggest that you stop the game until there is an actual key-input (whatever controls you have set). Like this the player has the time to arrange everything to his liking before starting the game. Because, even if you figure out how to analyse the focus-issue: When the game starts, the window HAS focus, therefore this approach wouldn't work anyway.
0
2,019
0
2
2014-12-08T04:22:00.000
python,window,pygame
How to focus on a window with pygame?
0
1
1
27,357,511
1
0
0
In my app I need to know how big the canvas is in pixels. Instead calling canvas.size returns [100,100] no matter how many pixels the canvas is wide. Can you please tell me a way to get how many pixels the canvas is wide and high?
true
27,358,870
1.2
0
0
3
There is no position nor size in a Canvas. Canvas act just as a container for graphics instructions, like Fbo that draw within a Texture, so it have a size. In Kivy, Canvas.size doesn't exists, but i guess you called your widget a canvas. By default, a Widget size is 100, 100. If you put it into a layout, the size will be changed, when the layout will known its own size. Mean, you need to listen to the changes of the Widget.size, or use a size you known, like Window.size.
0
5,156
0
2
2014-12-08T13:15:00.000
python,kivy
Size of canvas in kivy
0
1
3
27,380,669
1
0
0
I need to send some data from a Python program to a C++ program. The current design is such that the C++ program executes the python program in a separate thread. I wish to pass some result from the python program back to the C++ program. What I have found so far includes: Sending over sockets Sending via a pipe Using a temporary file Embedding the python interpreter in the C++ program Using boost.python My data (to be passed back to the C++ program) is essentially a python dictionary, and a few files. (I am sending email details, and the attachments). What strategy should I use? Is there anything I can do to make my work easier? Or can I improve my program design? EDIT: Added boost.python to the list of options found.
false
27,384,091
0
1
0
0
I ended up altering the the modules such that the C++ part and the Python part can work more or less independently of each other. But if passing data was necessary, I guess I would have gone via the socket route.
0
622
0
0
2014-12-09T16:37:00.000
python,c++,c,sockets
Strategies to send data from a Python program to a C++ program
0
1
1
27,401,759
1
0
0
I have a project that uses COM and 'Python' scripting. Earlier we were using 'ComTypes' now we use Win32Com. To keep backward compatibility I need to change name of some of the interfaces. So here is what I do 1) Use the 'makepy' utility to create a python file from my .tlb file, this creates a .py file at ..\Lib\site-packages\win32com\gen_py folder 2) I change the name of the interface that I am interested in changing in the created python file. 3) When I load my application a corresponding .pyc file gets created and everything works fine. Now I don't want to repeat this exercise on every machine where my software is deployed. So through the installer I copy the .py and .pyc files to ..\Lib\site-packages\win32com\gen_py But when my application is launched it does not recognize the changed interface. Behaves as if there is no .py or .pyc file. All other interfaces work, but the changed name one does not work. It dynamically seem to create compiled python behind the scene, ignoring the .pyc file. If I delete the .dat file and .pyc file at those locations, it does create the .pyc file again when the application is launched. However its not utilized, because my changed interface does not work. If I use the steps 1,2 and 3 everything works again !! I am puzzled. Please help.
false
27,385,373
0
0
0
0
OK. I found out what is the problem. When you create a python file using makepy tool it updates the dicts.dat file in gen_py directory. So you need to copy over that file as well to other machines.
1
190
0
0
2014-12-09T17:44:00.000
python,win32com,typelib
python .pyc file with win32com
0
1
1
27,413,739
1
0
0
On scrollable tkinter objects in Python, when you call .yview(), it returns their current 'position'. I can't make heads or tails of what it returns, though. For example, when scrolled to the beginning of one of my elements, it returns (0.0, 0.4662309368191721), and when at the end, (0.5337690631808278, 1.0). What do these numbers mean? Why are there two of them? It seems to me like it'd make more sense if there was only a single number, from 0(beginning) to 1(end).
true
27,413,547
1.2
0
0
1
The two numbers represent the fractional part of the data that is visible. A value of 0 (zero) means you are at the top (or left, in the case of xview), and a value of 1 (one) means bottom (or right). So, for example, if the very middle of the document were at the top of the screen, the first number would be .5. If a document that is three times as long as the screen was perfectly centered, the numbers would be something like (.333,.666) meaning the top one third is scrolled off of the screen, and the bottom one third is scrolled off the screen.
0
267
0
0
2014-12-11T00:46:00.000
python,scroll,tkinter
What do the values in obj.yview() mean?
0
1
1
27,414,982
1
0
0
while developing qpython scripts, it would be much easier to develop them on a pc and only transfer them to the android device for testing. What is the easiest way to do such a transfer? (Development might require to do this very frequently) Thanks in advance for all your feedback. tfv
false
27,438,448
0
0
0
0
QPy for android has built in FTP. Just enter the local address it provides into an ftp program (like bareftp for ubuntu)
0
1,287
0
1
2014-12-12T06:57:00.000
qpython
How to easily transfer qpython scripts from windows to android for development?
0
3
3
42,170,785
1
0
0
while developing qpython scripts, it would be much easier to develop them on a pc and only transfer them to the android device for testing. What is the easiest way to do such a transfer? (Development might require to do this very frequently) Thanks in advance for all your feedback. tfv
false
27,438,448
0.066568
0
0
1
In linux with ADB installed, in terminal you can use adb push pcprojectfolder /sdcard/com.hipipal.qpyplus/projects/androidprojectfolder You do need to manually end the task on the phone before pushing though.
0
1,287
0
1
2014-12-12T06:57:00.000
qpython
How to easily transfer qpython scripts from windows to android for development?
0
3
3
29,536,167
1
0
0
while developing qpython scripts, it would be much easier to develop them on a pc and only transfer them to the android device for testing. What is the easiest way to do such a transfer? (Development might require to do this very frequently) Thanks in advance for all your feedback. tfv
false
27,438,448
0
0
0
0
There is a ftp service in setting part which can help you to translate files between android device and pc.
0
1,287
0
1
2014-12-12T06:57:00.000
qpython
How to easily transfer qpython scripts from windows to android for development?
0
3
3
27,445,725
1
0
0
I came across a feature in some programming languages to call methods in other programming languages. Its called the Foreign Function Interface. For example, I would be able to call a C Language function inside a Python program. Or I could I write a wrapper for some C library in Python language for other Python users to use those. One simple example is the ctypes in Python. So using this, I can access the time function in libc. I understand to this level. However, I couldn't get a clear picture of how this ctypes itself is implemented and other 'behind the scene' things! The questions that arise for me here are: What kind of features do a compiler for this language require to use the Foreign Function Interface. Because it should also compile the foreign language as well. So if the host language is object oriented, and foreign language is not, then I need some kind of mapping to and from objects. How is this handled? What if the host language runs on a Virtual Machine? The Instruction Set would be different in that case, right?
true
27,449,735
1.2
0
0
3
Because it should also compile the foreign language as well. No. ctypes, and the like, only need to be able to link to object code. This depends on the target foreign language having appropriate conventions for name mangling inside the object code, which C does. if the host language is object oriented, and foreign language is not, then I need some kind of mapping to and from objects. How is this handled? The C code needs to expose appropriate interfaces for the host language; or equivalently, use some C-language libraries to do so. CPython is written in C, so this is broadly speaking easy in that case. What if the host language runs on a Virtual Machine? The Instruction Set would be different in that case, right? The VM has to have the appropriate facilities to load compiled object code.
1
185
0
1
2014-12-12T18:20:00.000
python,c,cross-language
Wrappers for C API in programming languages
0
1
1
27,449,816
1
0
0
How would I draw a simple partially transparent rectangle in python. I would like to not download anything from the internet and purely use python 2.7.3. I would like to also control where the rectangle starts and ends and control its width and height. The end goal of this is to have a map (of michigan and its great lakes) and have color coded rectangles pop up along the coast to visually show what the expected weather will be like based of buoys data from the NDBV. So in short, a map that i can place color coded rectangles on, that will be oriented along the coast of western michigan.
false
27,465,157
0
0
0
0
Check out svgfig or svgwrite for svg reportlab for pdf pyglet for drawing to a window
0
7,565
0
0
2014-12-14T00:37:00.000
python,python-2.7,graphics,geometry
Drawing basic shapes in python 2
0
1
2
27,465,376
1
0
0
Protobuf with pure python performance 3x slowly on pypy than CPython do. So I try to use c++ implementation for pypy. These are two error (PyFloatObject undefined and const char* to char*) when I compile protobuf(2.6.1 release) c++ implementation for pypy. I compile successfully after I modify python/google/protobuf/pyext/message.c,But I get 'Segmentation fault' error finally when I use protobuf with c++ implementation on pypy. I don't know how to fix it, help me please!
false
27,517,939
0.197375
1
0
1
So this is a happy non-answer using my experience. The pure-python bindings for google protobuf are a terrible port of C/C++ stuff. However, I had quite a bit of success wrapping C google protobuf generated bindings using cffi. Someone should go ahead and create a more generic binding, but that would just a short consulting stint.
0
567
1
2
2014-12-17T03:40:00.000
python,c++,protocol-buffers
Is there any way to use Google Protobuf on pypy?
0
1
1
27,687,619
1
0
0
I want to create some GTK+2 applications using Python 3. I searched many places, but can only find tutorials for using GTK+2 together with Python 2, using PyGtk, or GTK+3 together with Python 3, using PyGobject. Is there any way to create GTK+2 applications using Python 3?
true
27,542,828
1.2
0
0
2
Technically, it is possible, but not advisable. If you compile GTK 2.24 yourself with GObject introspection turned on, and don't have GTK 3.x installed, then you should be able to use from gi.repository import Gtk to access the GTK 2 API. However, this is not supported in any way, and even prints out a warning message to that effect. I don't even know if it still works. Even if it does work, it's still a bad idea; if your application only works on an unsupported configuration like this, then how are you going to distribute it?
0
824
0
1
2014-12-18T09:08:00.000
python-3.x,gtk2
Is it possible to create GTK+2.x applications using Python 3?
0
1
1
27,592,574
1
0
0
I have made a small program in Python that involves tkinter, and I made it a pyw file because it has a shortcut on the desktop and I do not want the command prompt to get in the way. I used py2exe following the sentdex tutorial on youtube, and I got an output file, but the output file shows an error and exits before I can read it. The pyw file on its own works fine, but I don't know how to get the exe output file to work correctly. Information: Python - 3.4.2; OS - Windows 8.1; Folder - Multiple items (photos and audio for the program); Program - A simple animation in tkinter If you need the program, tell me and I can upload the folder containing the program.
false
27,586,108
0
0
0
0
As far as I understand there is not a version of py2exe for python3.x You'd be best of going for cx_freeze (Sentdex also has a tutorial on that on that)
0
216
0
0
2014-12-21T02:02:00.000
python-3.x,tkinter,exe,py2exe
Python py2exe with tkinter (pyw file)
0
1
1
29,677,578
1
0
0
I have create some custom dialogs in wxpython that I am very happy with. I can execute pretty much anything I want based on user interaction and then once "OK" is selected collect the information from whatever functions I have run. What I am wondering is there a way to execute a final function at the time "OK" is selected. I do not have any sample code because I am not sure where to start and the demo does not do this, if it did my question would be answered by that. So lets say that in the dialog I have calculated A and B and when "OK" is selected I want to execute C = str(A) + "whatever" + str(B) So that upon exit I can dlg.C.GetValue() =
true
27,615,219
1.2
0
0
0
Just create self.C in your custom dialog's __init__ method. Then bind your OK button to a handler and update it as you mentioned. Then you should be able to get its value just as you stated: value = dlg.C.GetValue(). One thing to keep in mind is that when you create the OK button, do not set its id to wx.OK. If you do, it may not call your custom event handler as wx.OK is a special id that has a special default handler.
0
237
0
1
2014-12-23T06:33:00.000
wxpython,customdialog
WXPYTHON CUSTOM DIALOG
0
1
1
27,622,152
1
0
0
Im using Qpython3 on Android 4.2.2. Im currently able to list the latest sms from a particular contact and extract a 10 digit phone number. I want to update a contact's phone number with this number. How should I do this ? To be more precise, I want to be able to: Access the contact list. Update contact phone number with this phone number Is this possible with Qpython3 ?
false
27,642,293
0
0
0
0
Try to run it in console because you can communicate with the interpreter directly
0
90
0
0
2014-12-24T21:26:00.000
android,qpython3
How do I add a phone number to a contact using Qpython3
0
1
1
27,642,399
1
0
0
How could I hide an existing Label when a button is clicked in Python(Tkinter)?
false
27,654,494
0.321513
0
0
5
Use can use grid_remove() to hide the label. like self.myLabel.grid_remove(). If you want to show it again then use self.myLabel.grid(). This will show widget on its original position on grid.
0
29,265
0
4
2014-12-26T08:06:00.000
python,python-3.x,tkinter,label
Hide label when a button is clicked in Python
0
1
3
32,515,869
1
0
0
Versions Python 3.4 with Pygame 1.9.2 Question How can I pass the name of a function/method from one module, where this function does NOT exist, to the module containing it without having to resort to making it a string and evaluating it by eval()? Background I have a simple MVC pattern for training purposes. For simplicity's sake let's just presume we pressed a button in the menu. Here's what happens: The controller sends our event, the click as ClickEvent (containing position, mouse button and if the button was pressed or released), to the currently running logic, the menu. The menu then evaluates the click depending on its position and if it happened on a button, it returns a ModelEvent containing the name of a method of the model. The model then receives said ModelEvent and evaluates it. If any visible changes happen, it creates a new ViewEvent (this would go beyond my question). Approaches I approached the problem in three ways so far, once by lambda (which doesn't seem to fit my needs at all or I horribly misunderstood it) and twice by using strings with eval(). The shortcomings of the latter approach are obvious: The name of the function has to be passed between the instances as a string and then evaluated by eval() which takes its time. What would be an efficient way to pass the names of methods and functions from one module, where they don't exist, to another, where they are to be executed, without having to use strings and eval()? Or, if you see any grave mistakes in my general approach, I'd be glad to hear about it as I'm still learning.
true
27,744,155
1.2
0
0
0
When I understand you correctly, you are mixing Callbacks with Events.Perhaps this makes the problem so problematic. In Python functions are objects, and can be passed as any other object like strings. So there is no need to pass names and evaluate them.
1
116
0
0
2015-01-02T15:03:00.000
python,lambda,pygame,eval
Python: Passing a function name as an argument between modules
0
1
1
27,744,281
1
0
0
-I'm using python and cocos2D I have the file loading a tmx-map but now I want to change a specific tile to display an image from another file, I have saved the specific tile that I want to change in a variable but changing it I don't know how. Thanks in advance
false
27,761,448
0.197375
0
0
1
All I had to do was cell.tile.image = image
0
266
0
0
2015-01-04T01:27:00.000
python,tile,tmx,tiled,cocos2d-python
python cocos2d change tile's image
0
1
1
27,761,506
1
0
0
TextInput class Is there any way to append or edit text ??? Problem: I created TextInput object and accessed text method to print strings. But every time I access text method, it prints new string and it doesn't retain previous value. How to fix the issue? what is alternative for TextInput?
false
27,776,107
0.197375
0
0
1
Just replace the text with some function of the original string, e.g. textinput.text = ''.join('something ', textinput.text.replace('a', 'b'), ' and something else').
1
1,054
0
2
2015-01-05T08:56:00.000
python,kivy
edit or append text (TextInput class) in kivy
0
1
1
27,779,076
1
0
0
I'm running QPython on my Android device. Whenever I try to import Tkinter, it says, "no modules found". What is the package name for Tkinter in PyPI? Or where can I download the Tkinter package for QPython?
false
27,804,805
0.197375
0
0
1
Tkinter is not installed with QPython, unlike SL4A and Kivy. You'll have to install it yourself. There is a pip console among the scripts, so I'd try using that first.
0
6,218
0
1
2015-01-06T18:26:00.000
tkinter,pypi,qpython
QPython on Android doesn't get imported
0
1
1
30,358,514
1
0
0
I have a Python wrapper (to a C lib) generated by Swig. Have unittest run happy within PyDev. Project structure follow PyBuilder suggested setup: |-src |-main |-python |-A.py |-_A.so |-unittest |-python |-A_tests.py when try run pyb, got following error: Fatal Python error: PyThreadState_Get: no current thread Abort trap: 6 NOTE: If I change A to a pure Python module, everything works. Must be something (step) missing related to load that .so file. Sorry for a newbie question like this. Any help will be greatly appreciated.
false
27,807,343
0
1
0
0
is it possible you build the .so library for another python version? PyBuilder does not do anything special about shared objects, especially not when running unit tests. So try running ldd _A.so and see if that matches the interpreter you're using with pyb?
0
53
0
0
2015-01-06T21:18:00.000
python,swig,pybuilder
PyBuilder broken for Swig-Python generated wrapper project
0
1
1
27,814,800
1
0
0
I have been having problems importing Tkinter. I have done research here and found that it's because I have had both 64 bit and 32 bit python on my machine. I currently use 32 bit but Tkinter is pointing to the 64 bit version. I think the easiest fix is to uninstall python and reinstall it. Will I loose all my downloaded libraries and code I've written if I do this? It's python 2.7 on Windows 7.
true
27,810,710
1.2
0
0
1
All the downloaded libraries are in the C:\Python27\Lib\site-packages. You can check this folder before you uninstall a version of Python. I agree with Rinzler, for Python, both versions will have its own Tkinter. Maybe it's just a problem of interpreter choice of your IDE.
1
2,920
0
0
2015-01-07T02:46:00.000
python,python-2.7
Uninstalling Python - Do I loose my installed packages and code?
0
1
1
27,810,779
1
0
0
community! My problem: I have an item, namely gi.repository.Gtk, marked as "Unresolved reference: Gtk". The Gtk module did not exist at the moment of setting up Python SDK in Idea, however I've installed it little bit later. I can't get how do I force re-sync of classpath for python?
true
27,813,209
1.2
0
0
0
Normally the binary modules for a Python interpreter are rescanned on IntelliJ IDEA restart. Please try restarting the IDE.
1
93
0
0
2015-01-07T05:52:00.000
python,intellij-idea
intellij: update classes in classpath for python plug-in
0
1
1
27,828,457
1
0
0
I had created an application in Python and then I tried to make an executable from it. Works well in Ubuntu and Windows but only when on this system I have Python installed. In other case (Tried only for Win) I get the error that "The application can't start because python34.dll is missing" What I do (filename is curr.py, also I have icon.res for icon): python C:\Python34\Scripts\cython-script.py --embed curr.py in curr.c replace wmain by main (without doing it app won't be compiled at all) gcc curr.c -o curr.exe -IC:\Python34\include -LC:\Python34\libs icon.res -lpython34 -mwindows --static Of course, If I copy python34.dll to the app's folder everything is OK. Do I have another way?
false
27,850,953
0
0
0
0
Just installed PyInstaller - it has the option to compile to one file.
1
13,987
1
2
2015-01-08T22:48:00.000
python,dll,cython
Python34.dll is missing
0
1
2
34,793,148
1
1
0
I've designed a desktop app using PyQt GUI toolkit and now I need to embed this app on my Django website. Do I need to clone it using django's own logic or is there a way to get it up on website using some interface. Coz I need this to work on my website same way it works as desktop. Do I need to find out packages in django to remake it over the web or is there way to simplify the task? Please help.
true
27,879,952
1.2
0
0
2
I'm not aware of any libraries to port a PyQT desktop app to a django webapp. Django certainly does nothing to enable this one way or another. I think, you'll find that you have to rewrite it for the web. Django is a great framework and depending on the complexity of your app, it might not be too difficult. If you haven't done much with web development, there is a lot to learn! If it seemed like common sense to you that you should be able to run a desktop app as a webapp, consider this: Almost all web communication that you likely encounter is done via HTTP. HTTP is a protocol for passing data between servers and clients (often, browsers). What this means is that any communication that takes place must be resolved into discrete chunks. Consider an example flow: You go to google in your browser. Your browser then hits a DNS server (or cache) that resolves the name google.com to some IP address. Cool, now your browser makes a request to that IP address and says "get me some stuff". Google decides to send you back a minimal amount of HTML and lots of minified JavaScript in the page. Your browser realizes that there are some image links in the HTML and so it makes additional requests to google to get each of the images so that it can display them. Now all the content is loaded on your browser so it starts to execute the JavaScript code, and that code needs some more data from google so it starts sending requests to google too. This is just a small example of how fundamentally different a web application operates than how a desktop application does. On a desktop app you have the added convenience that any operation doesn't need to be "packaged up" and sent, then have an action taken, etc (unless you're using a messaging architecture, but that's relatively uncommon outside of enterprise apps).
0
1,730
0
1
2015-01-10T18:52:00.000
django,python-2.7,pyqt4
Cloning PyQt app in django framework
0
1
1
27,880,120
1
0
0
I have a PyFloatObject that I want to convert to a C float. However, PyObjectFloat only provides a conversion to double. Can I safely cast a double to a float, or is there a function to convert PyObject to float i.e. PyObject_AsFloat.
false
27,951,419
0
0
0
0
sprintf into a buffer followed by atoi seems to do the trick
1
2,614
0
0
2015-01-14T20:01:00.000
python,c,python-c-api,python-c-extension
convert PyFloatObject to float
0
1
3
27,969,486
1
0
0
Is there a way to hide the IDLE (or not making it run at all), with a command, when launching a tkinter application, without having to build the application?
false
27,955,957
0
0
0
0
Execute it directly from the command line with python script.py.
0
155
0
0
2015-01-15T02:38:00.000
python-3.x,python-idle
Is there a way to hide the IDLE when running a tkinter application?
0
1
1
27,956,444
1
0
1
I'm running Paraview 4.2 on Linux. Here's what's happening: I load my XDMF/hdf5 data into PV, which contains vector data. I apply a glyph filter to the loaded data, and hit apply (thereby using the default mode of Uniform Spatial Distribution). No glyphs appear on screen, and the information tab shows that the filter has no data (0 points, etc.). If I switch to All Points, or Every Nth Point, it works fine and displays the glyphs oriented correctly. Annoyingly, if I then make a cone source, and change the input of the glyph to the cone, Uniform Spatial Distribution works fine for the cone. No errors come up anywhere when I do this, whether in the PV gui or through pvpython. Any ideas?
false
27,977,626
0
0
0
0
Uniform distribution works by picking a set of random locations in space and finding data points closet to those locations to glyph. Try playing with the Seed to see if that helps pick different random locations that yield better results. If you could share the data, that'd make it easier to figure out what could be going on here, as well.
0
653
0
1
2015-01-16T05:07:00.000
python,paraview
Paraview glyph uniform distribution does not work on my dataset
0
1
1
27,987,246
1
0
0
I'm working on a pygame project at the moment and I'm wondering if there is an easy way to delete all sprites in a class. I have all the sprites in a group called self.spritegroup, so I couldn't just delete all objects in a group. Is there a simple shortcut to delete all objects in a class?
false
28,006,100
0
0
0
0
Well you could always just re-assign a new group object to your old group. your_old_group = new_group I'm not entirely sure but it seems kill is meant to delete specific sprites.
1
1,778
0
1
2015-01-18T01:01:00.000
python,class,pygame
Pygame delete all objects in class
0
1
3
50,237,749
1
0
0
In a wxpython Combobox, long strings get left-truncated in the dropdown portion. This can result in some values looking identical when they aren't. I'd like to provide better information to the user than that. The following options occur to me: Insert elipses in the middle of the string before adding it to the combobox's dropdown choices and expanding it back before placing back in the edit portion. Show a tooltip of the full string when the user mouses/hovers over a value in the dropdown. Problem is, the Combobox class does not expose events that enable either of the above. How can I intercept the events corresponding to either of the above? Any other ideas for making long combobox strings visible to the user? Thanks, RichK
false
28,012,863
0
0
0
0
I would recommend using the ComboCtrl instead of the ComboBox. The benefit is that the ComboCtrl is a custom widget, so it allows more flexibility. For example, the ComboCtrl provides a scrollbar for long strings. Check out the wxPython demo for some good examples.
0
172
0
1
2015-01-18T17:52:00.000
combobox,wxpython
Showing long strings in wxpython Combobox dropdown
0
1
1
28,027,478
1
0
0
Is there a trick to show the grid layout cells (or the borders of the cells) when using it, in order to have a visual idea of what is going on behind the scenes? I have searched a little bit, but have not found nothing yet.
true
28,025,666
1.2
0
0
15
If you give the containing frame a color, and use options to put padding between cells, the background will bleed through the gaps. This only works where there are widgets. If you have spans that are empty, you won't see grid lines. It's important to realize that you aren't creating a grid object. "grid" is not a thing, it's just instructions for how to lay out a set of widgets. If there is nothing in a row or column, that column won't show up. You don't create a grid per se, you tell a widget to display inner widgets using conceptual rows and columns. Another trick to learning to work with grid is to give each frame you're trying to use in a grid a distinctive color so you can see where one frame ends and another begins. The best thing to do when struggling with a layout is to get out pencil and paper. Draw out your UI, and natural borders should be evident. You can then use that as a guide to decide what the grid options should be.
0
17,747
0
15
2015-01-19T13:24:00.000
python-3.x,tkinter
Show grid layout cells in tkinter
0
1
1
28,027,692
1
0
0
I have tried multiple times to use PyInstaller to bundle my Python2 programs, but it never seems to work with the Pygame module. I have seen many other issues on this topic, but I couldn't find any useful answers. Does anybody know a solution to this? I am trying to do this on Ubuntu 14.10. -Edit- To be more specific: "never seems to work" means that when I run PyInstaller and build the application it appears to work and makes the application. When you try to run the application nothing happens.
true
28,033,003
1.2
0
0
0
i suggest trying another program like py2exe to bundle python programs i currently have not had any issues with it. Their are lots of good youtube videos on the process which is cmd based. I have had some personal problems using pyinstaller and think it is just buggy assuming your program is not flawed.
1
9,558
0
6
2015-01-19T20:30:00.000
python,pygame,pyinstaller
Pyinstaller with pygame
0
1
2
28,058,867
1
0
0
How do you customize the kivy logo for a kivy app? I am using Buildozer in Ubuntu 14.04.
false
28,063,099
0.197375
0
0
1
These variables can be set in the buildozer.spec, e.g. icon.filename in the [app] section.
0
448
0
1
2015-01-21T08:58:00.000
python-2.7,customization,kivy
Customizing a kivy app logo using Buildozer
0
1
1
28,068,266
1
0
0
I am using PyQt5 to make the user interface. Now I have set up a tab widget, and I want to trigger the event at such a time when a specific tab is selected. In other words, for example, I have tab A and tab B, and I want to execute the function every time user is switching from tab A to tab B.
true
28,121,876
1.2
0
0
7
When a new tab is selected currentChanged(int index) signal of the QTabWidget is emitted. Just connect that signal to some slot and check the index of the newly selected tab which is passed as argument.
0
5,574
0
8
2015-01-24T03:07:00.000
python,qt,pyqt,qtabwidget
How to connect event when tab widget is selected?
0
1
1
28,122,425
1
0
0
So I have this little problem. When I try to install PyGame for Python 3.4 I download a .whl (wheel?) file and don't know how to use it. Some guys told me something about pip but don't know how to use/install it.
false
28,127,730
0.066568
0
0
3
14 y/o? Good for you! You can put the file into your python/scripts folder and run pip install *file* (where *file* is your filename).
1
64,844
0
9
2015-01-24T16:40:00.000
python,pygame,pip,python-3.4
How to install PyGame on Python 3.4?
0
1
9
28,127,786
1
0
0
I am using Pygame 1.9.2 with Python 3.4 to create a control program for a robot. The controller is a new Xbox One controller connected via USB which is working fine with pygame. The problem is that the trigger buttons are considered Axes which give values from -1 to 1 depending on how hard you press. Is there a way to change this to a range from 0 to 1 or any other range that does not include negative numbers? Thanks
true
28,132,156
1.2
0
0
0
(x + 1.0) / 2.0 where x is whatever you get from the controller should give you a range of 0..1 (the + 1.0 is to get you in the range 0..2)
0
1,152
0
0
2015-01-25T01:13:00.000
python,linux,arduino,pygame,raspberry-pi
How can I set the range for Xbox One controller Triggers using Pygame?
0
1
1
28,132,200
1
0
0
I am trying to run a simple Turtle Graphics file, but no drawing shows up and IDLE asks me what background color you want? What's wrong with my Python?
false
28,144,261
0
0
0
0
I was asked this question by a friend, and re installation solved the problem
0
197
0
0
2015-01-26T03:04:00.000
python,turtle-graphics
Drawing not shown using Python Turtle Graphics
0
1
1
28,177,122
1
0
0
I have a Pythonscript where I want to import pygameui. When I perform: sudo pip install pygameui in the terminal, I get the following message: Downloading/unpacking pygameui Running setup.py egg_info for package pygameui Requirement already satisfied (use --upgrade to upgrade): setuptools in /usr/local/lib/python2.7/dist-packages/setuptools-12.0.4-py2.7.egg (from pygameui) Downloading/unpacking pygame>=1.9.1 (from pygameui) Could not find a version that satisfies the requirement pygame>=1.9.1 (from pygameui) (from versions: ) No distributions matching the version for pygame>=1.9.1 (from pygameui) Storing complete log in /root/.pip/pip.log I am struggling to solve this issue. Can somebody help me?
false
28,150,201
0.099668
0
0
1
There is no "solution", only workarounds here. To have working environment I install system package with pygame (i.e. pacman -S python2-pygame in Arch Linux) then create virtualenv with --system-site-packages switch. Pygame has not been updated for more than 5 years so it's highly unlikely that any changes will come in foreseable future. Later in this virtualenv I can install PygameUI with --no-deps switch to skip dependency checks - Pygame is already installed in required version.
1
1,630
0
2
2015-01-26T12:32:00.000
python,pygame,raspberry-pi
Trouble with PyGameUI - RaspberryPi
0
1
2
32,603,009
1
0
0
I would like to know if Tkinter.Canvas is a classic or modern Python class, because super does not work as expected (for me).
true
28,174,683
1.2
0
0
3
All Tkinter classes in python 2.x are old style classes.
1
58
0
1
2015-01-27T15:59:00.000
python,python-2.7,tkinter,tkinter-canvas
Is Tkinter.Canvas a classic class?
0
1
1
28,174,950
1
0
0
I have just started using twillio. Im not sure if its the right tool for what I am trying. Currently if I dial my number, there is no ring, it just picks up straight away. The reason I am mentioning this is because I would like it to first ring before it picks up. So my user can actually put down the phone before the call is connected and the person is billed. Is this possible? My number is new, nothing has been setup or done to it.
false
28,222,797
0.099668
0
0
1
This is where Twilio gets tricky. Technically the call is picked up instantly, so there is no timeout to let it ring. What you can do, is initialize the phone call with a timeout, and using the Play verb, use an MP3 recording of the standard ring before letting the program do it's thing.
0
91
0
0
2015-01-29T19:17:00.000
python,rest,twilio
Letting twillio ring before it picks up
0
1
2
28,222,877
1
0
0
I have a pygame program where there's a face in the center. What I want the program to do is have a bunch of objects on the screen, all irregular. Some would be circles, others would be cut-out pictures of objects like surf boards, chairs, bananas, etc. The user would be able to drag the objects around, and they'd collide with each other and the face in the center, and so be unable to pass through them. Could anyone show me how I would do this? Thanks! -EDIT- And by not be able to pass through, I mean they'd move along the edge of the object, trying to follow the mouse.
true
28,228,431
1.2
0
0
0
What you are looking for is functionality usually provided by a so-called physics engine. For very basic shapes, it is simple enough to code the basic functionality yourself. (The simplest case for 2D shapes is the collision detection between circles). Collision detection gets pretty hard pretty quickly, especially if you want to do it at a reasonably fast rate (such as you would need for the sort of project you are describing) and also especially if you are dealing with arbitrary, non-regular shapes (which your description seems to indicate). So, unless you are interested in learning how to code an optimized collision detection system, I suggest you google for python physics engines. I have never used any, so I can't personally recommend one. Good luck!
0
123
0
0
2015-01-30T02:48:00.000
python,pygame,collision
Pygame image collision
0
1
1
28,228,513
1
0
0
I have an aplication in IronPython where I load my xaml with wpf: "wpf.LoadComponent(....xaml)" I have a Button and a TextBox in my app and when I push the button, the app start doing a 2 minute work, I need to update the textbox of the aplication during this work. But I can´t do it. My textBox only update it when the 2 minute work finish. Any help? Thank you
false
28,233,768
0
0
0
0
Following snippet might help you. XAML : <Label Content="" HorizontalAlignment="Left" Margin="62,163,0,0" VerticalAlignment="Top" Height="472" Width="880" Foreground="Black" FontSize="18" Background="White" x:Name="label1"/> IronPython : def Button_Click1(self, sender, e): self.label1 = self.FindName('label1') self.label1.Content = "Test Succeeded" pass
0
2,205
0
0
2015-01-30T10:24:00.000
wpf,xaml,textbox,ironpython
How to update TextBox using wpf, IronPython
0
1
3
53,803,083
1
0
0
I am embedding Python in C++. I have a working C++ Python extension object. The only thing wrong is that if I set tp_dealloc to a custom function it never gets called. I would have thought Py_Finalize() would trigger this, or maybe terminating the program. But no. Could anyone suggest why tp_dealloc isn't getting hit?
true
28,266,847
1.2
0
0
1
I believe the problem here was one of reference counting. PyType_Ready() fills various tp_* fields depending on the bases of your type. One of these is tp_alloc, which I have set to 0. Its doc says the refcount is set to 1 and the memory block is zeroed. Every instance Python creates of this type, a new PyObject get added to the appropriate Python Dictionary. If it is a module level variable, this is the module's dictionary. When the dictionary is destroyed, it DECREF-s contained objects. Now the refcount will be 0, and tp_dealloc will get run. It appears that in my code I was performing an extra INCREF somewhere and the object was never getting garbage collected. It seems that (unless you compile with the specific flag) Python has no linked list that would allow it to track all of its objects. So we can't assume that Py_Finalize() will clear up. It won't! Instead, every object is held in the dictionary for its containing scope, and so on back to the module dictionary. When this module dictionary is destroyed, the destruction will creep outwards through all the branches.
0
290
0
1
2015-02-01T19:28:00.000
dealloc,python-c-api
tp_dealloc not getting hit upon exit
0
1
1
28,297,671
1
0
0
I have created a program in python(Tkinter) which takes username and password as input and a button which, when pressed, goes through a function which checks the username and password and further runs the program. I want that, rather than clicking the button, user presses the 'Enter' key and that does the function of the button. please help.
false
28,282,005
0
0
0
0
I believe you'll want to bind the key to your handler: frame.bind('<Return>', some_handler).
0
8,809
0
1
2015-02-02T16:16:00.000
python,tkinter
Getting values by pressing 'Enter' key rather than clicking a button
0
2
3
28,283,243
1
0
0
I have created a program in python(Tkinter) which takes username and password as input and a button which, when pressed, goes through a function which checks the username and password and further runs the program. I want that, rather than clicking the button, user presses the 'Enter' key and that does the function of the button. please help.
false
28,282,005
0
0
0
0
For me, the normal binding to a function did not work. Probably because I am using it inside a class, I used the Lambda function and it worked. Here's the code: inp.bind('', lambda _: show())
0
8,809
0
1
2015-02-02T16:16:00.000
python,tkinter
Getting values by pressing 'Enter' key rather than clicking a button
0
2
3
37,026,723
1
0
0
I've installed Python 2.7.6 (32-bit) on Windows 7 (64-bit). This works fine in Windows Power Shell. I set the PATH to C:\Users\name\Python27\Scripts, and that didn't seem to be a problem either. I then downloaded a pygame install file, pygame-1.9.2a0-cp27-none-win32.whl, from: http://www.lfd.uci.edu/~gohlke/pythonlibs/#pygame I put the .whl file into the Python27\Scripts directory, and tried using pip install pygame-1.9.2a0-cp27-none-win32.whl in Windows Power Shell (command line, not Python interpreter), and the error message is this: The term 'pip' is not recognized as the name of cmdlet, function, script file, or operable program. I tried using Python 2.7.8 (the later version of Python 2.7, if I'm not wrong) with an .msi install of pygame, but I experienced other errors with this that I thought could be fixed with a fresh install. I am very new to programming and using the command line; any help is appreciated.
false
28,310,782
0
0
0
0
you must not have set the path variable in windows..it's the same mistake that i made.. set the environment variable in windows by doing fallowing steps: right click 'My Computer' go to properties Advanced System Settings Environment Variables and set Path there.. if this doesn't help then try another method : open your python installation directory goto Tools Scripts Run "win_add2path.py" Now try to run $) pip install, commd.. if it still doesn't work .. restart your console or restart the PC @shub1493biswas@gmail.com
1
559
0
0
2015-02-03T23:30:00.000
python,pygame,pip
can't install pygame using pip, Python 2.7.6 on Win7
0
1
1
28,639,628
1
0
0
I currently use Cython to build a module that is mostly written in C. I would like to be able to debug quickly by simply calling a python file that imports the "new" Cython module and test it. The problem is that I import GSL and therefore pyximport will not work. So I'm left with "python setup.py build; python setup.py install" and then running my test script. Is this the only way? I was wondering if anyone else uses any shortcuts or scripts to help them debug faster?
false
28,489,542
0
1
0
0
I usually just throw all the commands I need to build and test into a shell script, and run it when I want to test. It's a lot easier than futzing with crazy Python test runners.
1
87
0
4
2015-02-12T23:01:00.000
python,cython
Better Way of Debugging Cython Packages
0
1
1
29,159,267
1
0
0
I'm going through some PyQt4 GUI tutorials and often see strings such as "&File" or "&Exit" in menus and the like. My question is what is the purpose of the "&" symbol in this string? I can't see a difference when I miss it out. I've not come across it in other Python tutorials - is it somehow unique to PyQt? Thanks.
true
28,502,910
1.2
0
0
3
The & causes PyQT to display an underscore under the letter that serves as a shortcut key for the menu item.
1
784
0
1
2015-02-13T15:25:00.000
python,string,pyqt4
What is the purpose of an ampersand (&) in a PyQt4 string?
0
1
1
28,502,943
1
0
0
I am making an first-person open-world game in Blender Game Engine(bge), and intend to have the terrain be generated procedurally. I have looked around from website to website, and have only found various ways for the game to generate terrain in the "edit" mode, but not a way to generate it in blender game engine, eg. I would like it so that every time you play, the terrain is different. Is there any way to do this with python code, or at all? Thanks in advance for your help! Note: When I say procedual, I do not mean for the world to be infinitely large, eg Minecraft(although acquiring a solution that supported that would be awesome)
false
28,507,678
0
0
0
0
Procedurally generating terrain on the fly is not that easy, but it is possible. You must create the terrain mesh with its triangles and textures during runtime and then dynamically load/unload the parts the player can see. So you would not create a single big landmass, but rather divide your terrain in smaller chunks than you can load and unload as needed. To create the actual terrain you could use a height-map or a noise algorithm.
0
519
0
0
2015-02-13T19:53:00.000
python,python-3.x,game-engine,blender
Procedualy Generateing Terrain in Blender Game Engine
0
1
1
28,684,387
1
0
0
I already tried to google it but I couldn't find anything ... I created tkinter canvas with width 800, height 600 apparently, the left upside will be (0,0) I want to change left downside to (0,0) How can I do this???
false
28,510,010
0
0
0
0
You cannot change the coordinate system of the canvas. You can scroll the canvas so that 0,0 is in the bottom left, but the y coordinates will be negative going up.
0
209
0
0
2015-02-13T22:43:00.000
python,tkinter,coordinates
How can I convert coordinate in tkinter?
0
1
2
28,510,642
1
0
0
Im fairly new to python. I creating a game similar to asteroids, and so far I've gotten the spaceship to move around with the arrow keys. can someone explain what i would do to make the spaceship rotate in the direction its moving? thanks in advance!
false
28,553,439
0
0
0
0
Each of your sprites should have velocity attributes. If your velocity is negative, turn one way. If your velocity is positive, turn the other. Because velocity indicates the direction of movement, this can be used to determine angular direction.
0
774
0
0
2015-02-17T01:52:00.000
python,pygame
python/pygame: how would i get my sprite to rotate in the direction it's moving?
0
1
2
28,553,503
1
0
0
When dealing with C extensions with Python, what is the best way to move data from a C++ array or vector into a PyObject/PyList so it can be returned to Python? The method I am using right now seems a bit clunky. I am looping through each element and calling Py_BuildValue to append values to a PyList. Is there something similar to memcpy?
true
28,560,045
1.2
1
0
1
You have to construct a PyObject from each element prior to adding it to a sequence. So you have to either add them one by one, or convert them all, then pass to a constructor from PyObject[]. I guess the 2nd way is slightly faster since it doesn't have to adjust the sequence's member variables after each addition.
0
983
0
0
2015-02-17T10:40:00.000
python,c++,c
Best way to copy C++ buffer to Python
0
1
3
28,560,741
1
0
0
I am trying to open a file, remove some characters (defined in dic) and then save it to the same the file. I can print the output and it looks fine, but I cannot save it into the same file that the original text is being loaded from. from tkinter import * from tkinter.filedialog import askopenfilename from tkinter.messagebox import showerror import sys import fileinput dic = {'/':' ', '{3}':''}; def replace_all(text, dic): for i, j in dic.items(): text = text.replace(i, j) return text class MyFrame(Frame): def __init__(self): Frame.__init__(self) self.master.title("Example") self.master.rowconfigure(5, weight=1) self.master.columnconfigure(5, weight=1) self.grid(sticky=W+E+N+S) self.button = Button(self, text="Browse", command=self.load_file, width=10) self.button.grid(row=1, column=0, sticky=W) def load_file(self): fname = askopenfilename(filetypes=(("Napisy", "*.txt"), ("All files", "*.*") )) if fname: try: with open (fname, 'r+') as myfile: #here data = myfile.read() #here data2 = replace_all(data, dic) #here print(data2) #here data.write(data2) #and here should it happen except: showerror("Open Source File", "Failed to read file\n'%s'" % fname) return if __name__ == "__main__": MyFrame().mainloop() I have tried several commands but either I am receiving python errors or it is simply not working.
false
28,582,037
0.099668
0
0
1
This is often implemented by writing to a temp file and then moving it to the original file's name.
1
649
0
0
2015-02-18T11:06:00.000
python-3.x
How can I save output tho the same file that I have got the data from, in Python 3
0
1
2
49,924,334
1
0
0
I have a python(2.7)/wxpython program developed on windows, which I am trying to migrate to mac but am encountering some problems. The bit I am having problems with consists of two panels: Panel A consists of a tree control containing key=value pairs and with user editing disabled. Panel B consists of a set of controls of various types (filePicker, textCtrl, valueCtrl, choice, checkbox, comboBox, and spinEdit), all of which are initially disabled When the user selects a tree node the program checks the key and decides which control on panel B should be used to edit the tree node's value. Panel A then sends the relevant info to panel B using pubsub which initializes and enables the relevant control. Each control on panel B has a EVT_KILL_FOCUS event so that when the user moves away from the control, the controls value is sent back to panel A using pubsub and the tree node's value is updated and the editing control on panel B is disabled. This works fine on windows. On mac I have the following problems: The filepicker and spinCtrl can not be disabled - this could lead to incorrect information being sent back to the treeCtrl if either of these controls inappropriately receives focus the spinctrl, choice, checkbox, and comboctrl appear not be be triggering EVT_KILL_FOCUS events and so no information is sent back to the treeCtrl. I fixed this on the choice control by binding the EVT_CHOICE. Using non-focus events for the other controls doesn't work as well and creates undesired behaviors. So my questions are: 1: is it possible to disable the filepicker and spinCtrl on OSX? 2: is there a way to use the kill focus events of the spinctrl, choice, checkbox, and comboctrl controls on mac? 3: if fill focus events can not be used, is there an alternate event that would be triggered after editing is complete, for each of these controls? Thanks Rob
false
28,702,522
0.379949
0
0
2
Which version of wxPython are you using? Disabling those kinds of widgets seems to be working fine for me with current builds. For some reason Apple thought that it was a good idea to never give the keyboard focus to some types of controls, because apparently nobody would ever want to use them with anything but a mouse or trackpad. So if the widget never gets the focus, then it can never lose it and so there won't be any EVT_KILL_FOCUS for it either. You can change this in the Keyboard panel in System Preferences by setting "Full Keyboard Access" to "All Controls"
0
68
0
0
2015-02-24T17:35:00.000
python,macos,wxpython
wxpython control problems when migrating from win to mac
0
1
1
28,724,680
1
0
0
I have some problems with an App, which I wrote with kivy an packaged with buildozer is always crashing when I try to run in on my phone. On my PC I use Ubuntu 14.10 and I don't get any error when compiling it (buildozer android debug). Then I send it on my SmartPhone and I install and run it, but it just loads and after a few seconds it crashes. By the way the kivy program is not very big. Could someone help me, please? And sorry for my bad grammar ;)
false
28,722,273
0
0
0
0
If you are using kivy and your app loads some images, then there is no problem. But if you are using some other packages like pygame to load images, it will crash. Or if you are working in some files like reading or writing a text file, it will crash. Because when you package your app with buildozer, It will move the additional files of your app (.txt, .png) to a different location. So your python file fails to find the additional files in your specified location. To solve this, do some corrections in your python file like changing the path of the additional file from the current directory of the python file to the path that is referred below. PATH = "/data/data/#package domain#.#package name#/files/app" In the above path change #package domain# with the domain of your package and #package name# with your package name. All the additional files of any app that is installed in an android device will go to this location. Try out this. All the best.
0
2,562
0
1
2015-02-25T14:58:00.000
python-2.7,kivy
Android App created with Kivy (Buildozer) crashes on phone, but why?
0
1
3
63,775,920
1
0
0
I have been trying to get a program I wrote in PyQt to work being called from a CUPS backend on OS X. The problem is that CUPS sandboxing keeps the program from being able to access the PyQt python modules which I have brewed in /usr/local/Cellar. Is there any way to grab those files, as well as the Qt files in the Cellar, and put them all in one contained folder? It is simple for other modules, but PyQt depends on a lot itself. I tried using pyinstaller and cx_freeze, but with no luck. How can I round up all my applications dependencies into one location?
true
28,723,232
1.2
0
0
1
I got around the CUPS sandboxing by having the backend send the information to a listening server on localhost that then processed the job as I needed it. I made sure that the server listening would only accept connections from localhost. I never was able to get pyinstaller or cx_freeze to work with PyQt, but this workaround was a better alternative.
0
191
1
0
2015-02-25T15:42:00.000
python,qt,pyqt,cups
Rounding up Dependencies for PyQt
0
1
1
30,196,277
1
0
0
First off please do not mark this topic as a duplicate. All the relevant threads are years old. I would like updated information. What are the pros and cons of the following libraries? I am aware of: PyGame, seems to be the most popular but the website is full of broken links and no news in awhile. Cocos2D Python, Seems good as cocos2D is all the rage right now. Almost no support though and the stack overflow pages only seem to get a post every couple weeks. Pyglet, This is the only one I never tried as Cocos2D seems to use Pyglet. Seems to update more then the cocos2D python stack overflow but less then the pygame. Other? Rate a better library! I am looking for information on ease of use, preferably pythonic and up to date. But perhaps most importantly active.
false
28,733,056
0.197375
0
0
2
Pygame and Pyglet are definitely on the radar. Pygame Great, popular game engine. No support for a variety of file types. But it's no longer maintained. Pyglet Very powerful, high support for many files. Thorough documentation. OpenGL support, intuitive. Cocos2D I really feel that Coco2D is just an unnecessary medium to use the underlying Pyglet engine.
0
1,029
0
2
2015-02-26T01:42:00.000
python,pygame,pyglet,cocos2d-python
Python Game Libraries
0
1
2
28,733,171
1
0
0
I'm using a combination of Python and Squish for Qt to write tests on a Qt GUI, but I have noticed when I copy and paste tests from a suite I have and move them to another suite or computer with Squish the file will run, but when it runs anytime it sees an object name it does not recognize it and throws an exception. Most of the time I use the picker tool to go get the object name and place it where the old object name was and it works (I might add that the object names haven't changed I'm literally copying and pasting a string over THE SAME EXACT string). I must be doing something wrong. Has anyone seen this or have a way of resolving the issue so I don't have to re-record?
false
28,749,243
0.291313
0
0
3
... but I have noticed when I copy and paste tests from a suite I have and move them to another suite or computer with Squish the file will run, but when it runs anytime it sees an object name it does not recognize it and throws an exception ... For your test script, Squish creates this suite folder you mention. Inside this folder, you also have besides the test.py file, a object.map file (in which squish stores all the objects that you use inside the test). Also, besides those 2 files you have a suite.conf file. Instead of copy/paste your test script file, you could move the suite folder on the other computer, and there open it in SquishIDE. Or along with the test script, copy also the object.map file.
0
246
0
0
2015-02-26T17:45:00.000
python,qt,squish
Has anyone seen Squish that you must re-record after moving?
0
1
2
30,211,284
1
0
0
I am new to tkinter and I was wondering if there is a way to clear whole root (window). I tried with root.destroy() , but I want to have a chance to undo(to callback some widgets). I also tried .pack_forget() and .grid_forget() , but it takes a lot of time and later may cause many bugs in program. Thank you for help.
true
28,752,446
1.2
0
0
2
If you plan on literally destroying everything in the root window, my recommendation is to make a single frame be a child of the root window, and then put everything inside that frame. Then, when you need to clear the root window you only have to delete this one widget, and it will take care of deleting all of the other widgets. If instead of destroying the widgets you want to merely hide them, the best solution is to use grid, so that you can use grid_forget to remove them from view, and grid to make them visible again. You can use pack and pack_forget, but pack doesn't remember where the widget was, making it more difficult to restore them without a lot of work. If your program is made of logical groups of widgets, use frames to create the groups, and then you can destroy or call grid_forget on the entire frame at once, rather than having to do that for each individual widget.
0
4,266
0
1
2015-02-26T20:46:00.000
python,tkinter
Clear whole root
0
1
2
28,753,245
1
0
0
I want to ask a ObjectListView object if and which of its columns (index would be enough) are sorted and in which direction (asc or desc). I know ObjectListView.GetSortColumn() which return a ColumnDef object. But I can not see a way how to ask about the index of the ColumnDef. In wx.ListCtrl I can not found anything about sorting.
true
28,777,882
1.2
0
0
0
There is no real getter. Use ObjectListView.sortColumnIndex for that. It will be '-1' if none of the columns are used for sorting. btw: How can I add code here? The "code snipped" symbol just come up with a ugly un-understandable dialog.
0
81
0
0
2015-02-28T03:45:00.000
python,objectlistview
How to ask a ObjectListView which column is ordered and in which direction?
0
1
1
28,974,102
1
0
0
I am using Pygame to get values from a Simraceway steering wheel, which is just seen as a joystick. There are three axes on the joystick -- one for steering, one for the left paddle, and one for the right paddle. When I do the Pygame command get_numaxes(), I correctly get back 3 axes. But when I do the command get_axis(1), which should return the value for the left paddle, I do not get the correct value. I do get the correct values for get_axis(0) (the steering) and get_axis(2) (the right paddle). In Windows, the left paddle shows up as Z-rotation rather than a normal axis. I'm not sure if that has anything to do with it. Why is get_axis(1) not getting the position of the left paddle? Is there any program other than Pygame that will work better at getting a Z-rotation axis from this joystick, like Windows does?
false
28,780,611
0
0
0
0
I was not able to figure out why get_axis(1) did not get the position of the left paddle. However, I was able to use evdev to get all the information I need from the steering wheel. It's not very high level, unlike Pygame, but it does work.
0
542
0
0
2015-02-28T10:20:00.000
python,pygame,joystick
Pygame.not getting value for one of axes on the joystick
0
1
1
28,937,815
1
0
0
When I Debug my Python C extension using Visual Studio the program abort with the message: "PyThreadState_Get: no current thread". In Release the program works fine and if I add debugging information it still works fine. How to solve the problem?
false
28,805,401
0
0
0
0
If NDEBUG is defined you have to use the Debug version of the interpreter python_d.exe. Furthermore if the name of the extension is myextension the name of the Dll in Release must be myextension.pyd but in Debug the name of the Dll must be myextension_d.pyd
1
304
0
0
2015-03-02T08:30:00.000
python,pycxx
Debugging my Python C extension lead to "PyThreadState_Get: no current thread"
0
1
1
28,805,402
1
0
0
I have a window with two grids in it. Example for using: Making some operations on grid1. When making operations on another object in this window(like the other grid) I want to do final operation on grid1. What is the right event for this?
false
28,807,448
0
0
0
0
You can use focus events. Either catch wx.EVT_KILL_FOCUS which fires when you leave the grid widget or catch wx.EVT_SET_FOCUS when you enter a new widget. Then you can do something in your event handler to update grid1.
0
18
0
0
2015-03-02T10:25:00.000
python,wxpython
wxpython event on deactivating a grid
0
1
1
28,818,633
1
0
0
I am trying to use gtk table in one of my projects(GUI based) to show a pair of columns and its values. Since gtk table doesn't have borders by default, my GUI is not coming up well. So, Is there anyway I can add borders to gtk table and its cells? If no can I create a customized widget with borders by extending gtk Table? How can I create a customized widget in pygtk? P.S: I have tried gtk Treeview and gtk Frames and thats not what I want. Also I have created a gtk treeview for each pair of columns and its values but the GUI works very very slow.
false
28,811,104
0
0
0
0
Assuming you want five pixels of spacing, if you would like to have space between the different cells of your table, you can try table.set_row_spacings(5); table.set_col_spacings(5); If you would like to have space around the entire table, you can do table.set_padding(5).
0
1,159
0
1
2015-03-02T13:34:00.000
python,gtk,pygtk
Add border to table in pygtk
0
1
1
34,956,262
1
0
0
Is it possible that when a Tkinter window is made bigger or larger, everyhting in the window is scaled? So all the proportions stay the same but their sizes vary. Now when the window is resized all the buttons etc stay the same so I disabled resize because there is no point, it just looks bad.
false
28,811,202
0
0
0
0
No, it is likely not possible, depending on what you mean by "everything" and what you mean by "scaled". Any widget can be made to stretch to fill its allotted space. Text widgets and canvas widgets, for example, scale nicely. A button or label will fill the space it's in, but the text inside the widget won't change (that is also true of text and canvas widgets). It's possible to organize your GUI so that when the window resizes, everything remains in its proper place at its original size. Having buttons that automatically scale is not something most people would expect. Disabling resizing usually results in a poor user experience -- users should have the ability to make a window larger or smaller.
0
569
0
0
2015-03-02T13:39:00.000
python,tkinter,ttk
Tkinter - scale all components on resize?
0
1
1
28,813,514
1
0
0
I am using Python C Api to embed a python in our application. Currently when users execute their scripts, we call PyRun_SimpleString(). Which runs fine. I would like to extend this functionality to allow users to run scripts in "Debug" mode, where like in a typical IDE, they would be allowed to set breakpointsm "watches", and generally step through their script. I've looked at the API specs, googled for similar functionality, but did not find anything that would help much. I did play with PyEval_SetTrace() which returns all the information I need, however, we execute the Python on the same thread as our main application and I have not found a way to "pause" python execution when the trace callback hits a line number that contains a user checked break point - and resuming the execution at a later point. I also see that there are various "Frame" functions like PyEval_EvalFrame() but not a whole lot of places that demo the proper usage. Perhaps these are the functions that I should be using? Any help would be much appreciated!
true
28,817,249
1.2
0
0
2
PyEval_SetTrace() is exactly the API that you need to use. Not sure why you need some additional way to "pause" the execution; when your callback has been called, the execution is already paused and will not resume until you return from the callback.
1
179
0
1
2015-03-02T18:49:00.000
python,python-c-api
How to implement breakpoint functionality in a embedding of Python
0
1
1
28,817,512
1
0
0
I am having trouble posting an erase background event to draw to the screen. In my full code, I want to draw a bitmap (DC.DrawBitmap()) when a button is clicked. I do that by posting an EVT_ERASE_BACKGROUND event which is caught by a custom bound method. However, once it is in that method, the event.GetDC() method that normally works fails. Here is a simplified code that has the same result: import wx class Foo(wx.Frame): def __init__(self, parent, title): wx.Frame.__init__ (self, parent, -1, title, size=(500,300)) self.panel = wx.Panel(self, -1) self.Bind(wx.EVT_ERASE_BACKGROUND, self.OnEraseBackground) self.Bind(wx.EVT_ENTER_WINDOW, self.onEnter) self.Show() def OnEraseBackground(self, e): DC = e.GetDC() def onEnter(self, e): wx.PostEvent(self, wx.PyCommandEvent(wx.wxEVT_ERASE_BACKGROUND)) app = wx.App() Foo(None, 'foo') app.MainLoop() This raises: AttributeError: 'PyCommandEvent' object has no attribute 'GetDC' How can I solve this?
false
28,824,286
0
0
0
0
Worked on it for an hour without success before posting, then solved it myself five minutes later... Here's my solution, creating a ClientDC if the event doesn't have its own DC: import wx class Foo(wx.Frame): def __init__(self, parent, title): wx.Frame.__init__ (self, parent, -1, title, size=(500,300)) self.panel = wx.Panel(self, -1) self.Bind(wx.EVT_ERASE_BACKGROUND, self.OnEraseBackground) self.Bind(wx.EVT_ENTER_WINDOW, self.onEnter) self.Show() def OnEraseBackground(self, e): try: DC = e.GetDC() except: DC = wx.ClientDC(self) DC.Clear() def onEnter(self, e): wx.PostEvent(self, wx.PyCommandEvent(wx.wxEVT_ERASE_BACKGROUND)) app = wx.App() Foo(None, 'foo') app.MainLoop()
0
499
0
0
2015-03-03T04:47:00.000
python,wxpython
wxpython Post Erase Background with DC
0
1
1
28,824,375
1
0
0
I'm making a GUI with Tkinter, and I need to find a way to know if a widget (let's call it l = Label(root, text="test")) is packed or not. I know I can do if l in Tk.pack_slaves(root):..., but this seems inefficient. Is there any way of adding a "line" to the widget.pack() method, such as telling it to set an attribute to widget.is_packed = True? Or is there a way of telling a class, On_method_call(pack()) do this? Cheers.
true
28,856,501
1.2
0
0
2
No, there is no built-in way to do it. It's your code doing the packing, so you can store a flag in a dictionary, or create your own pack function to do that automatically.
0
473
0
0
2015-03-04T14:06:00.000
python,macos,oop,tkinter
Tkinter "on-pack" method or "is-packed" attribute
0
1
1
28,856,654
1
0
0
When I create a QMainWindow without explicitly specifying its dimensions, PyQt will give it a -let's say- "standard size" which is not the minimum that the window can get. Can I set this size at will in any way? My goal is to get this "standard size" according to the currently visible widgets, when I set the visibility of some widgets on/off.
true
28,915,681
1.2
0
0
1
QWidget.sizeHint holds the recommended size for the widget. It's default implementation returns the layout's preferred size if the widget has a layout. So if your dialog has a layout, just use sizeHint to get the recommended size which is the default one.
0
1,830
0
0
2015-03-07T14:04:00.000
python,qt,pyqt
how to get the default size of a window in pyqt4
0
1
3
28,923,741
1
0
0
I have this game which I have coded in python with pygame. When I launch my game through the renpy launcher, it works just fine. When I emulate my game through the renpy android emulator, it works just fine. When I go through each of the build steps (install sdk, configure, build package, install package) it completes successfully. The package is installed on my connected android device. When I open the game on my android device, it says: "ImportError: No module named renpygame." When I build the game and play it on my desktop I don't have this problem. I'm guessing somehow renpygame is not getting included in the package when I go through the build process in renpy for Android, but I don't know why or how to fix it. I'm not even getting an error message, I don't know where to start.
false
28,921,997
0.197375
0
0
1
I e-mailed PyTom, the creator of Ren'py, and he responded back instantly: "Edit the rapt/blacklist.txt file, and delete the line that says **.py. " It worked! Thanks, PyTom.
0
1,556
0
0
2015-03-08T01:11:00.000
python,android,pygame,renpy
Ren'Py with Renpygame for Android
0
1
1
28,922,150
1
0
0
I have a Notebook and add two panels to it. When I try to get the usable area of one of the panels, it returns (20,20) -- I imagine this is its size before stuff is put in. I want to get this size before I put stuff in because some proportions depend on it and I'd prefer not using absolutes. I haven't set an actual size, I just sized everything with a boxsizer and set proportions. I'd like to get the actual pixel width of the area allotted to the panel (it doesn't take up the entire program window area). I've tried calling Layout before GetSize, I've tried GetVirtualSize and Get ClientSize and any other available size returns, still (20, 20) or sometimes (10,40). I've tried getting the parent size, no go. I get the grandparent size and it shows correctly, but this is the size of the entire program window. Is there a way to get the potentially usable area of a panel? If need be, I can post the layout, but it's long.
false
28,931,533
0.197375
0
0
1
It sounds like you are trying to do this at the time of the creation of the window, before the initial layout and sizing is done, so everything still has its initial size. There are some alternative ways to deal with this situation. You could delay creating the content of the panel until the first size event. Or you could design your sizer layout to be adaptable to any (resonable) size. Or you could adjust/redo the sizer layout later if needed. Or perhaps the easiest would be to send a fake size event to the parent or top-level parent so they will do what their normal layout resizing the child windows, which will cascade to your panel. This may not work in all situations, but it is common enough that there is a window method for it, SendSizeEvent.
0
172
0
0
2015-03-08T20:30:00.000
user-interface,wxpython
wxPython -- GetSize doesn't return actual size
0
1
1
28,946,737
1
0
0
There's a method to set the "letter spacing" for a wx.TextCtrl? (or another widget where I can show a small phrase) Or is a property of the wx.Font? Or is a inherent property of the font face I'm using? A work-around I could implement is to write my custom control (maybe derived from RichTextCtrl) where I draw each character one by one, and add the selected spacing between them. But then it would be a lot less efficient to calculate (giving an example) the area of the text. This is rather simple with a ClientDC.
false
28,972,266
0
0
0
0
No, I don't believe this is a feature of any of the text controls or their variants. You could set the wx.Font to a monospace font, but that's probably about as good as you can get going the "automatic" way. I would recommend drawing it yourself if that's really what you need.
0
83
0
0
2015-03-10T19:17:00.000
fonts,wxpython,label,spacing
Letter spacing in wxpython widgets
0
1
1
28,973,871
1
0
0
This is the situation I have: I created an installer. It has python scripts, executable, and other file types. In the installer, I run a C# executable as a custom action, after registering the product. The C# executable moves the files into different locations (i.e. a text document will be moved to My Documents). I understand I can do this without the custom actions, but I was not aware of that when I created the installer. Now, after I have distributed the software, users are running into small bugs. For instance, there is a bad if check in one of the python scripts. Question Is there a way to fix the portion of the python script/executable/text document that is broken, and simply update those files (without having to redistribute the software to the users, and having them reinstall it)?
false
28,972,637
0
0
0
0
A patch probably won't help you. If the locations are fixed within the install, a minor upgrade could do the trick, if you make all the files that need to stay the same "never overwrite" (unless the custom action ignores this, then things might get difficult). If the locations are determined during the execution of the custom action, or the locations are based on user input during the install, then you have a problem if you haven't saved the location paths (in the registry, for example). I don't think you want a custom action to scan all the drives of the computer just to find the files. If the files are put in their new locations by the custom action, windows installer probably won't see them as key files and probably won't "repair" them in any scenario. If the fixes are few, you might be better of distributing the files separately with a clear instruction, in stead of spending many hours on a difficult new custom action. Cheers, B.
1
52
0
0
2015-03-10T19:38:00.000
c#,python,installshield,patch,software-distribution
Upgrading Application using InstallShield
0
1
2
28,975,982
1
0
0
Sorry, thought i edited to say i am on windows 64 bit When trying to install Pygame using pip, I get the following error: "requirement 'pygame.whl' looks like a file name, but the file does not exist pygame.whl is not a valid wheel filename." I have my file paths right and pip is working. I have attempted to install 32 bit and 64 bit pygame but neither is working. In the command prompt I enter "pip install pygame.whl" (I renamed the file which I don't think should matter and it is saved under downloads). How can I resolve this error?
true
28,997,501
1.2
0
0
0
Thankyou so much for your help ventsyv, i finally figured it out. i believe it was an issue with the installer from pygames site. i found another site with a link to pygame and specifically for python 3.4.2. i now have no error messages and its working great. Thanks for putting up with me haha.
1
2,022
0
1
2015-03-11T21:15:00.000
python,installation,pygame,pip
Error while installing pygame using pip for python 3.4
0
1
2
29,056,557
1
0
0
I'm trying to run scripts on qpython3, android 5.0.1 and when executing the scripts nothing happens. Even the example scripts that are installed with the app. Interactive mode/running commands in console does work, only scripts don't. What could be the reason?
false
29,031,089
0.197375
0
0
1
I had that issue on 4.4.4. Hit Run in the editor, then in the console it brings up you can cd to the directory the program is in and use the command 'python file.py' to start the program. It's a little annoying, but it's better than not being able to run programs at all. This problem disappeared for me on 5.1.1.
0
1,329
0
0
2015-03-13T11:29:00.000
python,python-3.x,qpython,qpython3
Scripts won't run on QPython3
0
1
1
30,599,421
1
0
0
I'm programming python + Gtk3. I have a Gtk.TreeView with a Gtk.ListStore as model. At some point of the program I need to destroy the treeview in order to put a fresh one on it's place. However I don't know what happens with the model. Should I destroy it, clear it, or just leve it there and let python to eat it? I've also thinked in recycle the same model to the new treeview, but I'd prefer not: too much trouble... Thanks!
true
29,044,228
1.2
0
0
1
You can leave it to Python's garbage collector, the same way it would go if you'd close the application (it will call g_object_unref on both). That said, remember that the idea behind the separation of models and views, is that you can mix them the way you like, i.e. display the same model in different views or even alternatively displaying different models in the same view. That you need to replace both may indicate problems in the way you are designing your UI.
0
79
0
1
2015-03-14T00:51:00.000
python,treeview,gtk3,treemodel
Should I 'destroy' a liststore (model of treeview) when destroy treeview?
0
1
1
29,044,826
1
0
0
I want to add colorless icons to menu items. To look reasonably, the icons should have the same color as the text used in the menu. It works everywhere except Ubuntu. The problem is that the default Ubuntu Unity theme uses different colors for the main menu and for other text (e.g. popup menus) in the application. I need the color specifically used by the main menu. QApplication.palette().color(QPalette.Text) returns the dark gray color used by text in the application. It's almost invisible on the dark gray menu background. I tried the palette() method on a QMenu descendant, but it returns the same value as QApplication.palette().
false
29,045,905
0
0
0
0
It turns out QMainWindow.menuBar().palette() has colors matching the Unity menu on top of the screen (I just learned it's called appmenu). That makes it possible to use the same color as the menu text. But there is a problem. The version of the icon for the QtIcon.Active mode is not used for the active menu item. That can be seen in the high contrast mode. The text color changes, but the icon color doesn't. The icon "disappears" when the menu item is selected. That's not good enough for a polished program. I tried many workarounds, such as adding extra pixmaps to the icon with QIcon.addPixmap(). Nothing works. The appmenu operates in a separate process and doesn't want to our "Active" icon. So I'm going to draw real icons that look good on any reasonable background and don't need to change color with the widget. Too bad. I expected that the QIcon mode and state were made specifically for such tasks.
0
332
0
1
2015-03-14T05:49:00.000
python,qt,ubuntu,pyqt,themes
PyQt: How to find menu text color in that works with Ubuntu Unity?
0
1
1
29,109,067
1
0
0
As we all know, when developing an Android app in native Java, we use activities. I was wondering that, in developing Android apps in Python(with Kivy), does Kivy implements activities for the apps in itself or not? because I don't see any activity implementation on the sample codes. If it doesn't implement activities, Do we lose performance or any functionality in the application compared to coding in native Java?
true
29,058,419
1.2
0
0
2
Simply put, you can use Activities (starting them using pyjnius), but not really define them, at least, it's not usually the way one work with kivy. Kivy doesn't adjust its way of working for targetted platform, it uses its own systems, and make them work there. For what i know the advantages of separating Activities on android is just a way to make your code more neatly organized, and doesn't imply performance changes. It can allow you to start your app in various ways (from a share, for example) but you can do that with p4a/buildozer too, by dispatching messages about the intent, if you need to. With kivy, you'll organise your code like you would do for any python project, using modules.
0
1,092
0
5
2015-03-15T07:48:00.000
android,python,kivy
Python - Does Kivy implements activities in the Android apps?
0
2
2
29,059,931
1
0
0
As we all know, when developing an Android app in native Java, we use activities. I was wondering that, in developing Android apps in Python(with Kivy), does Kivy implements activities for the apps in itself or not? because I don't see any activity implementation on the sample codes. If it doesn't implement activities, Do we lose performance or any functionality in the application compared to coding in native Java?
false
29,058,419
0.099668
0
0
1
Kivy is a great tool for developing Android Apps. The best advantage of using Kivy is that it is cross platform and the same project can be used to publish apps on mutti-platforms. However , it has some performance related disadvantages(as do most cross-platform tools like unity , cocos etc). If you're developing only for Android , I'd suggest taking a look into development tools which use Java. This will help create a smaller APK file which in turn helps in better user retention. I guess you are real loyal fan of Python, but I have to tell you about its advantage and disadvantage. Advantages Pure python and its almightiness is in your hand. Relatively simple to deploy with buildozer without any need to dive too deep into the details of particular platform. You can run your app on desktop also, so there is no need to install some extra emulators/VMs to get it work Disadvantages Not that much information in Internet, even on stackoverflow Pretty messy documentation No obvious way to test the application Not obvious machanisms of placing widgets, especially in built in layouts, which causes situations like: you want place widget in the center of it's parent, but kivy places it anywhere but not where you want it to be. Official examples are quite ugly, so you may get false vision of how your application could look like.
0
1,092
0
5
2015-03-15T07:48:00.000
android,python,kivy
Python - Does Kivy implements activities in the Android apps?
0
2
2
29,058,632
1
0
0
I recently used homebrew to install pyqt (along with qt & sip), but get an import error whenever I try to import PyQt4 in Python 3 (which was also installed using homebrew). To confuse matters more, I am able to import PyQt4 on Python 2 via the terminal. I'm totally new to working with Python packages and, with that, totally confused. Any thoughts on how I might be able to undo what I did and reinstall so that I can access PyQt via the usr/local/python3 installation? Thanks in advance!
false
29,069,364
0.197375
0
0
2
brew reinstall pyqt --with-python3 will get you sorted!
1
562
1
0
2015-03-16T03:47:00.000
python,homebrew
Python 3 can't find homebrew pyqt installation
0
1
2
29,091,698
1
0
0
I'm using wxpython. I'd like to solve a simple problem for a GUI that consists of a button "Add", which when pressed creates a new button called "Remove". You can press "Add" as many times as you like and many remove buttons are created and added to the panel. What I would like is for when you press one of the remove buttons, that remove button itself is removed from the panel. The problem is when you bind a function to a button with this: self.Bind(wx.EVT_BUTTON, self.remove_function, button_name) you can't pass an argument to the function telling it which button to remove. (Or can you?)
false
29,100,233
0.066568
0
0
1
If your trouble is to pass an argument to the function, consider following: self.Bind(wx.EVT_BUTTON, lambda e: otherFunction(arg1, arg2), button_name)
0
2,124
0
1
2015-03-17T13:23:00.000
wxpython
A simple example for adding and removing buttons in wxpython
0
1
3
29,101,131
1
0
0
I am coding a Tkinter GUI for a senior research project at school. I need to, at some point in the code, reset the counter used to create id values for new additions. Does anyone know if this is possible beside replacing the entire canvas? Basically, after adding a bunch of lines and ovals, I need to delete them all and restart the counter at 1 for new ones. Second, I have taken the path of replacing the entire canvas, and afterwards, nothing EVER shows up in the winfo_get() method. Why could this be? I know I'm trying to do something that TKinter isn't supposed to do, but it must be possible.
true
29,107,842
1.2
0
0
2
It is not possible to reset the id numbers generated by a canvas. Your solution of deleting and recreating the canvas is a reasonable alternative, though it may not be necessary. There are probably better ways to do whatever it is you think is solved by resetting canvas ids. For example, you could generate your own ids, and associate each id with each canvas item as a tag. You can then reset the ids any time you want.
0
813
0
2
2015-03-17T19:18:00.000
python,tkinter,tkinter-canvas
Tkinter Canvas reset ID's
0
1
1
29,107,985
1
0
0
I have written a Python module designed to solve the Tetris cube tiling puzzle, and it contains a lot of code, but it doesn't want to run, when I press f5 to run the program, the shell restarts, but then stops working, even when I enable debugging nothing happens still. I put a print statement at the very start of the program, yet it is not executed, and I cannot terminate the program using ctrl-c. I was able to fix this problem by putting some of the functions I had defined into a separate module, and now it works fine, but if I create a new function, and add enough print statements, the problem reappears, but can be fixed by just removing one statement. The version of Python I am using is Python 2.7.8
true
29,111,073
1.2
0
0
0
The problem seems to have been an issue with the version of python I had installed. A new installation is able to run long modules fine, without any noticeable delay even from pressing f5 to first print statement.
1
118
0
0
2015-03-17T22:40:00.000
python,module,compilation
Does python have a limitation on the amount of code in a module?
0
1
1
31,042,764
1
0
0
Is there any form to set a 100% of horizontal size for TextCtrl in Toolbar? Because I have been looking for about this in the documentation and I did not found anything.
false
29,112,631
0
0
0
0
You probably can't do that in a normal toolbar. However, you can easily just roll your own toolbar by using a horizontally oriented BoxSizer and adding the necessary widgets to it. Then you can add the text control with the correct proportion and the wx.EXPAND flag.
0
20
0
0
2015-03-18T01:20:00.000
python,user-interface,wxpython
Is there any form to set a 100% of horizontal size for TextCtrl in Toolbar?
0
1
1
29,130,791
1
0
0
I'am trying to build an e-commerce website using turbogears. Initially I modified the tgapp-photos to make the items come on the page properly. But then I find it difficult to make cart from the scratch and hence thought to use stroller. However, when I'am plugging it in the config.py file, all of a sudden my app stops. And moreover it is not showing any error too, it just stops. Could someone please tell me what wrong am I doing. Can I use satchless or shoppingCart in the turbogears framework?
true
29,116,195
1.2
0
0
0
Stroller is a pretty old project that is not maintained anymore. The reason why it was not working for you is that it was still pending some changes required to make it compatible with TG2.3+, it was compatible only with <=2.2. And so was looking for some Pylons imports. To solve your problem I just released stroller 0.5.1 which is now compatible with TG2.3, please keep in mind that as it is a pretty old project it depends on ToscaWidgets1 and doesn't work with TW2 so you should: Remove tw2.forms dependency from your project setup.py Uninstall tw2.core and tw2.forms from your virtualenv (if they are available sprox will use tw2 and some forms in stroller won't work) change base_config.prefer_toscawidgets2 in base_config.use_toscawidgets = True Those are the required step to disable ToscaWidgets2 in your project and revert back to ToscaWidgets1 which is required by stroller.
0
56
0
0
2015-03-18T07:20:00.000
python-2.7,e-commerce,shopping-cart,turbogears2,satchless
stroller (turbogears) not working
0
1
1
29,133,585
1
0
0
I've been working really hard trying to find a solution to this for the past few weeks. I have committed to a direction now, but I am still not entirely satisfied with what I have come up with. Asking this now purely out of curiosity and for hope of a more proper solution for next time. How on earth do I keep multiple QAbstractItemModel classes in sync that are referring to the same source data but displaying in different ways in the tree view? One of the main reasons for using model/view is to keep multiple views in sync with one another. However, if each of my views requires different data being displayed at the same column, as far as I can tell I need to then subclass my model to two different models with different implementations that will then cater to each of those unique view displays of the same items. Underlying source items are the same, but data displayed is different. Maybe the flags are different as well, so that the user can only select top level items in one view and then can only select child items in the other view. I'll try to give an example: Lets say my TreeItem has three properties: a, b, c. I have two tree views: TreeView1, TreeView2. Each has two columns. TreeView1 displays data as follows: column1 -> a, column2 -> b TreeView2 displays data as follows: column1 -> a, column2 -> c I then need to create two different models, one for TreeView1 and one for TreeView2, and override the data and flags methods appropriately for each. Since they are now different models, even though they are both referring to the same TreeItem in the background, they are no longer staying in sync. I have to manually call the refresh on TreeView2 whenever I change data on TreeView1, and vice versa. Consider that column1, or property a, is editable and allows the user to set the name of the TreeItem. Desired behaviour would be for the edit that is done in TreeView1 to instantly be reflected in TreeView2. I feel like I am missing some important design pattern or something when approaching this. Can anyone out there see where I am going wrong and correct me? Or is this a correct interpretation? Thanks!
false
29,132,741
0.379949
0
0
2
One way to do it is to use viewmodels. Have one QAbstractItemModel adapter to your underlying data model. All interaction must pass through that model. When you need to further adapt the data to a view, simply use a proxy view model class that refers to the adapter above and reformats/adapts the data for a view. All the view models will then be automagically synchronized. They can derive from QAbstractProxyModel, although that's not strictly necessary. There is no other way of doing it if the underlying source of data doesn't provide change notification both for the contents and for the structure. If the underlying data source provides relevant notifications, it might as well be a QAbstractItemModel to begin with :)
0
442
0
2
2015-03-18T21:10:00.000
python,qt,pyqt,pyside
How to keep multiple QAbstractItemModel classes in sync
0
1
1
29,132,919
1
0
0
Okay, so I am brand new at this and I really need for this to be dumbed down for me. My python version is 2.7.9 and I downloaded pygame-1.9.1.win32-py2.7.msi and I am on a windows computer. I really need someone to explain why this is not working. I was reading on some of the other questions that you have to change the path of python and I have no idea how to do that. I am literally screwed because I have to turn something in for a major grade and I have literally been trying to figure this out for like about four weeks now. When I try to import pygame, I get this error message and I have absolutely no idea what I am doing wrong: Traceback (most recent call last): File "C:\Users\Tiffany\Documents\NetBeansProjects\NewPythonProject\src\newpythonproject.py", line 3, in import pygame ImportError: No module named pygame
false
29,190,350
0
0
0
0
There is only really only one way to do this: Create a folder Put the Python Interpreter you are using in that folder Put the PyGame module you are using in that same folder And your problem is now solved. I hope this helps you!
1
3,786
0
0
2015-03-22T02:39:00.000
python-2.7,pygame,importerror
ImportError: No module named pygame and how to change the path of pygame?
0
1
1
29,221,166
1
0
0
I have written a monitoring program for the control system at our plant. It is basically a GUI which lets the operator see the current status of the lock of the closed loop system and aware the operator in case the lock/loop breaks. Now, the operation is heavily dependent on the responses of the GUI. My seniors told me that they prefer just the console prints instead of using TKinter based GUI as TKinter has lags while working in real time. Can anyone please comment on this aspect? Can this lag be checked and corrected? Thanks in advance.
false
29,190,427
0
0
0
0
I would say that if your program is simply accessing data and not interacting with the data, then a GUI seems to be a bit of overkill. GUI's are guided user interfaces, as you know, and are made for guiding a user through an interface. If the interface is just a status, as you indicated, then I see nothing wrong with a console program. If, however, your program also interacts with data in a way that would be difficult without a GUI, then the GUI is likely the right choice. Have you considered a GUI in another programming language? Python is known to be a bit slow, even in console. In my experience, C++ is faster in terms of viewing data. Best of luck!
1
1,676
0
1
2015-03-22T02:53:00.000
python,user-interface,tkinter
Python TKinter for real time GUIs
0
1
2
29,191,478
1