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
1
0
The other day I came across a Python implementation called Jython. With Jython you can write Java applications with Python and compile them to pure Java. I was wondering: Android programming is done with Java. So, is it possible to make Android apps with Jython?
false
11,120,130
0.141893
0
0
5
As long as it compiles to pure java (with some constraints, as some APIs are not available), but I doubt that python will be of much use in development of android-specific stuff like activities and UI manipulation code. You also have to take care of application size - that is serious constraint for mobile developement.
0
34,891
0
64
2012-06-20T12:58:00.000
android,python,jython
Programming Android apps in jython
0
6
7
11,120,423
1
1
0
The other day I came across a Python implementation called Jython. With Jython you can write Java applications with Python and compile them to pure Java. I was wondering: Android programming is done with Java. So, is it possible to make Android apps with Jython?
false
11,120,130
0.085505
0
0
3
Yes and no. With jython you can use java classes to compile for the JVM. But Android use the DVM (Dalvik Virtual Machine) and the compiled code is different. You have to use tools to convert from JVM code to DVM.
0
34,891
0
64
2012-06-20T12:58:00.000
android,python,jython
Programming Android apps in jython
0
6
7
23,649,506
1
1
0
The other day I came across a Python implementation called Jython. With Jython you can write Java applications with Python and compile them to pure Java. I was wondering: Android programming is done with Java. So, is it possible to make Android apps with Jython?
false
11,120,130
0.028564
0
0
1
Yes, you can. Test your python code on your computer and, when it is ok, copy to your Android device. Install Pydroid from Google Play Store and compile your code again inside the application and you will get your App ready and running. Use pip inside Pydroid to install any dependencies. PS: You will need to configure your Android device to install APKs from outside Play Store.
0
34,891
0
64
2012-06-20T12:58:00.000
android,python,jython
Programming Android apps in jython
0
6
7
53,232,363
1
1
0
The other day I came across a Python implementation called Jython. With Jython you can write Java applications with Python and compile them to pure Java. I was wondering: Android programming is done with Java. So, is it possible to make Android apps with Jython?
false
11,120,130
-0.057081
0
0
-2
It's not possible. You can't use jython with android because the DVM doesn't understand it. DVM is not JVM.
0
34,891
0
64
2012-06-20T12:58:00.000
android,python,jython
Programming Android apps in jython
0
6
7
13,966,835
1
0
0
How can I change behavior of how items are selected in QGridLayout by cursor keys? I want to move selection horizontally by left/right cursor keys and vertically by up/down keys. Who is responsible for it? Layout, items container or tab order?
true
11,120,427
1.2
0
0
1
You can reimplement keyPressEvent() method for the main widget to catch the pressed keys. Then you can access the desired widget in your layout by calling QGridLayout::itemAtPosition (int row, int column) and then set focus to it.
0
706
0
0
2012-06-20T13:15:00.000
python,qt,pyqt,grid-layout
Custom QGridLayout items selection behaviour
0
1
1
11,120,871
1
0
0
I am using Mac OS X 10.6.8, wxPython 2.9.3.1 and 64 Bit Python v2.7.2: My problem is not that easy to describe in a few key words, thats why I probably did not find a solution yet. I just just create a very simple wx.frame with some objects and arrange them with a sizer. If I then show the frame all elements are displayed at top of each other for a second. Then everything jumps into place and is displayed correctly. I tried to call all kinds of funktions before showing my frame like Refresh, wx.Yield, Update etc. but nothing helped. Is there some function to prevent a frame to be shown before it is drawn correctly or to draw it but to not show it yet? Thank you!
true
11,134,169
1.2
0
0
1
Typically when I see that issue, all that is needed is to call Layout right before you call the frame's Show() method. I would call Layout on the top sizer or the frame object. If that doesn't work, post a small runnable example and I'll update my answer.
0
218
0
0
2012-06-21T08:19:00.000
python,wxpython,sizer
wx Python frame elements not displayed correctly right after show using sizers
0
1
1
11,139,906
1
0
0
I have a very large amount of data that I wish to represent in 2d. What graphics libraries would be compatible with getting data from oracles databases and still have a smooth look to them? I don't wish to use tkinter.
false
11,140,710
0.664037
0
0
4
There is no connection between the library you use for graphics and the source of the data you are representing. When you say 2d I assume you are talking about graphs. In that case, try matplotlib or google charts api. Both work nicely with python and can represent your data in attractive looking 2d graphs
0
139
0
0
2012-06-21T14:46:00.000
python,oracle,graphics,2d,simulation
python 2d graphics that works with Oracle
0
1
1
11,140,908
1
0
0
Is there a way to store typed values (e.g., float, integer) in HBase and access these values from different clients? The Java client examples I've found uses the static methods of Bytes class to manually encode and decode the values. I haven't found any Thrift client examples which stores typed values. hbase.thrift doesn't specify and float, integer types. In short, I'm ready to store the type of fields in an external resource. I just want to be able to write from one client (e.g. Java), read from another (e.g. shell or Thrift via Python) without having to worry about the binary encoding issues. If that's not possible, I'd like to learn the best practices in encoding/decoding for multiple clients. Thanks.
false
11,143,979
0
0
0
0
No; HBase stores bytes, nothing more. Any further encoding or decoding must be done by you.
0
477
0
1
2012-06-21T17:56:00.000
python,types,hbase,thrift
Storing typed values in HBase
0
1
1
11,144,332
1
0
0
I'd like to invoke PySocketModule_ImportModuleAndAPI function defined in socketmodule.h in my Python C-extension.
false
11,172,215
0
1
0
0
I had a similar problem and resolved it by: Adding the Modules\ directory (from your Python source) to the C/C++ Additional Include Directories. #include "socketmodule.h" Don't know if this is the best solution, but it worked for me!
0
142
0
1
2012-06-23T19:07:00.000
python-c-extension,python-extensions
Is it possible to include socketmodule.h in Python C extensions?
1
1
2
20,085,116
1
0
0
Just a quick question.. Following opening a text file in a separate definition (no classes used) I have a 'table' (i.e a frame) that has n rows (depending on what is in the text file). As this number could be any number, is it possible to retrieve the number of rows afterwards since I have been given the task where I'm not to use classes but there cannot access the variables etc in the open definition. Thanks.
true
11,258,057
1.2
0
0
1
I figured it out. I used frame_table.grid_size() and have the columns and rows (7, 3). Sorry for the dull question!
1
72
0
0
2012-06-29T07:52:00.000
python,class,tkinter
Obtaining number of rows Tkinter
0
1
1
11,258,706
1
0
0
I've tried setting dlg.CenterOnParent() but that doesn't work. I assume it's because my MessageDialog is not setting the frame as the parent. In that case how would I do this?
true
11,282,099
1.2
0
0
0
When you create a wx widget, the normal pattern of the create function is wx.SomeUIObject(parent, id, ...). The parent could be set when you create the dialog.
0
176
0
0
2012-07-01T12:51:00.000
python,wxwidgets
How do I center a wx.MessageDialog to the frame?
0
1
1
14,640,674
1
0
0
Using PyGame, I get flickering things. Boxes, circles, text, it all flickers. I can reduce this by increasing the wait between my loop, but I though maybe I could eliminate it by drawing everything to screen at once, instead of doing everything individually. Here's a simple example of what happens to me: import pygame, time pygame.init() screen = pygame.display.set_mode((400, 300)) loop = "yes" while loop=="yes": screen.fill((0, 0, 0), (0, 0, 400, 300)) font = pygame.font.SysFont("calibri",40) text = font.render("TextA", True,(255,255,255)) screen.blit(text,(0,0)) pygame.display.update() font = pygame.font.SysFont("calibri",20) text = font.render("Begin", True,(255,255,255)) screen.blit(text,(50,50)) pygame.display.update() time.sleep(0.1) The "Begin" button flickers for me. It could just be my slower computer, but is there a way to reduce or eliminate the flickers? In more complex things I'm working on, it gets really bad. Thanks!
false
11,300,745
0.148885
0
0
3
You're updating your screen 2 times in a loop, one for drawing first text(TextA) and one for second text(Begin). After your first update, only first text appears, so you can't see begin text between first update and second update. This causes flickering. Update your screen after drawing everything. In your case, remove first pygame.display.update().
0
5,741
0
2
2012-07-02T20:31:00.000
python,pygame
Update display all at one time PyGame
0
1
4
11,300,894
1
0
0
I have a larger code running in Linux, written in c++ (c++11) and python and using numerous libraries (VTK, boost, pyqt, OpenGL) and compiles to python extension modules (and plugins of those modules) and pure python modules (the main program is a python script). The code is cross-platform (with a few exceptions, like dlopen, gettimeofday which can be replaced by windows equivalents via #ifdef's) and compiler-agnostic (it compiles with -ansi, and a few compiler-specific things like __attribute__ can also be, hopefully, replaced, if needed). I am cosindering attempting compilation on Windows, but I am totally lost on how should I proceed (I am fairly experienced with development in Linux, but I have not used Windows since late 90s). Should I go for mingw or MSVC compiler? Would I be better of to cross-compile? Do I need to install dependencies "by hand" by downloading installers from the web; do I need to compile those as well? Are there standard paths for include files, or are all of them to be detected? If I ever manage to compile it, how can make some sort of package (it is a bundle of pure-python modules and shared libs)? I assume I am not the first one who is trying to see how it works under Windows (I reckon I am spoiled by package managers and all dev-friendly things in Linux), perhaps there is a helpful reference somewhere.
true
11,314,253
1.2
0
0
0
I think your choice here depends on your goals for compiling under Windows. Are you preparing to involve other developers that can choose their development platform? Do you want to use a different compiler for additional warnings generation? Are you looking to deploy the application on the windows platform? Asking these kinds of questions should help you make a more informed decision. Here are some suggestions... It doesn't hurt to try MSVC. The 2010 express edition is the last free edition to support standard C++ development. Future express editions are for "Metro" apps only. I would weigh that against your goals for Windows development and choose accordingly. For a cross platform build, see if you can implement a standardized build system such as CMake or SCons. I wouldn't ship with dependencies, regardless of the final decision. It is standard practice for Open Source to require developers to download dependencies individually. Just be sure to include version information for anything where the current stable release is not backwards compatible with your application. (Or even better, FIX those problems so you get the benefit of the latest fixes in 3rd party code.) Python, at the very least, should be the responsibility of the developer. It is meant to be installed, and pywin32 extensions will register COM items in the system registry on a Windows installation. As far as recruiting Open Source developers, you may find that requiring MinGW to be installed on a developer's machine will discourage some of the dedicated MSVC users from working on the project.
1
534
1
2
2012-07-03T15:29:00.000
c++,python,windows,linux,porting
compiling+distributing Linux code on Windows
0
1
1
11,347,955
1
0
0
I'm trying to use the ScrolledPanel in wx.lib.scrolledpanel, and i would like to check if the scrollbar of the ScrolledPanel is currently visible, so i can give my StaticText the correct wrap width. Because when the scrollbar is visible i need to remove another 10 pixels or so from the wrap width... Anyone any idea how this is done? Thanks!
true
11,342,620
1.2
0
0
0
I solved this by getting the width of the parent widget inside the scrolledpanel, instead of the width of the scrolledpanel itself. Sometimes the answer is so obvious :)
0
134
0
0
2012-07-05T10:38:00.000
python,wxpython,wxwidgets
Check if wx.lib.scrolledpanel.ScrolledPanel is currently scrolling
0
1
1
11,382,239
1
0
0
How to change the button decoration with wxPython, generally when the button is clicked, a dotted lines appear on the button.. any way to make that button not show the dotted lines? Thanks
true
11,357,611
1.2
0
0
1
Assuming you're running your program on Windows (you didn't say which OS, but dotted lines are used by Windows Classic look), the dotted lines are called the focus rect, and they appear to mark a button or widget as focused. They are a system setting, and your program is acting as it should - wxWidgets is meant to emulate the underlying OS default behaviour as closely as possible. Update I don't think you can change this behaviour from inside the program. I really doubt that wxWidgets has a setting somewhere for this, as it is OS-dependent and is the standard and correct behaviour for the Classic theme. But the focus rect is shown by default only on the Classic Look which few people use. Try switching to Luna theme (the default on XP), and you'll see that the focus rect won't appear unless you start hitting Tab while your window is in focus. By the way, the focus rect is needed exactly for when you are switching the focus using the Tab key. You need to see where the focus is, after all. That way you know when you press Enter or Space, which button is going to be pressed. Not everyone uses only the mouse.
0
346
0
0
2012-07-06T07:22:00.000
python,button,windows-xp,wxpython
wxPython, button design
0
2
2
11,357,674
1
0
0
How to change the button decoration with wxPython, generally when the button is clicked, a dotted lines appear on the button.. any way to make that button not show the dotted lines? Thanks
false
11,357,611
0
0
0
0
You can use a custom button, for instance wx.lib.buttons.GenButton which is in pure python so you can overwrite the look, feel etc. This also has a method SetUseFocusIndicator to turn off the dotted focus indicator
0
346
0
0
2012-07-06T07:22:00.000
python,button,windows-xp,wxpython
wxPython, button design
0
2
2
11,361,156
1
0
0
I have a script to save between 8 and 12 images to a local folder. These images are always GIFs. I am looking for a python script to combine all the images in that one specific folder into one image. The combined 8-12 images would have to be scaled down, but I do not want to compromise the original quality(resolution) of the images either (ie. when zoomed in on the combined images, they would look as they did initially) The only way I am able to do this currently is by copying each image to power point. Is this possible with python (or any other language, but preferably python)? As an input to the script, I would type in the path where only the images are stores (ie. C:\Documents and Settings\user\My Documents\My Pictures\BearImages) EDIT: I downloaded ImageMagick and have been using it with the python api and from the command line. This simple command worked great for what I wanted: montage "*.gif" -tile x4 -geometry +1+1 -background none combine.gif
false
11,368,143
0
0
0
0
The easiest thing to do is turn the images into numpy matrices, and then construct a new, much bigger numpy matrix to house all of them. Then convert the np matrix back into an image. Of course it'll be enormous, so you may want to downsample.
1
3,192
0
2
2012-07-06T18:59:00.000
python,image,python-3.x,scaling,pixel
Python: Import multiple images from a folder and scale/combine them into one image?
0
1
4
16,485,248
1
0
0
In wxpython, is it better to handle events by creating a separate function for each event handler (say a separate function for every single button click) or to create one large button_handler, and then determine the button clicked from there? Basically, I am wondering if it is more resource intensive to have many different events being watched for each separate thing, or just one big event that will figure out which one was clicked when it was fired.
true
11,399,489
1.2
0
0
1
If I have three buttons that do radically different things, then I want different event handlers for them because I find that easier to debug. If they're all print buttons with slightly different formatting options applied, then I'll hook them all up to the same handler and use event.GetEventObject() to figure out which one called. The few times I've had multiple events handled by the same handler was when I had a toolbar button and a menu item both call the same thing. It has more to do with program flow and ease of debugging and that just comes with practice.
0
365
0
0
2012-07-09T16:43:00.000
python,events,wxpython,wxwidgets
event handling in wxpython
0
3
3
11,401,507
1
0
0
In wxpython, is it better to handle events by creating a separate function for each event handler (say a separate function for every single button click) or to create one large button_handler, and then determine the button clicked from there? Basically, I am wondering if it is more resource intensive to have many different events being watched for each separate thing, or just one big event that will figure out which one was clicked when it was fired.
false
11,399,489
0.132549
0
0
2
Resource intensity is not your issue here, but you would definitely want to use one big event loop for this. Due to the Global Interpreter Lock, many event handlers in python have annoying ways of dealing the event queue, and in some event handlers it may even be impossible to check the event without removing it from the stack (VPython for example), and so in these cases you may well run into strange and hard to track errors if you use multiple checks within your code. If you use one large event this won't happen, or if it does, will be much easier to track down. Ravenspoint is correct in that the resource intensity of either approach is trivial, and based on resource intensity alone you shouldn't worry about it, but a single event loop is significantly easier to maintain.
0
365
0
0
2012-07-09T16:43:00.000
python,events,wxpython,wxwidgets
event handling in wxpython
0
3
3
11,399,885
1
0
0
In wxpython, is it better to handle events by creating a separate function for each event handler (say a separate function for every single button click) or to create one large button_handler, and then determine the button clicked from there? Basically, I am wondering if it is more resource intensive to have many different events being watched for each separate thing, or just one big event that will figure out which one was clicked when it was fired.
false
11,399,489
0.132549
0
0
2
Don't worry about it. The resources required for either scheme will be trivial, especially in a python script. Focus on designing your code in the way that makes it easiest to understand and maintain.
0
365
0
0
2012-07-09T16:43:00.000
python,events,wxpython,wxwidgets
event handling in wxpython
0
3
3
11,399,632
1
0
0
I am looking for a way to embed an .exe into a frame. (MDI) I am not sure how this can be done. I am using wxpython 2.9 and there is nothing online about this (until now).
false
11,404,994
0
0
0
0
Embedding one GUI application inside another is not a simple thing. Applications are written to provide their own main frame, for example. You could try to position Notepad to a particular place on the screen instead. If you're really talking about Notepad, then you have a different course of action. Notepad is nothing more than a text control with some code to save and load the contents to a file.
0
389
0
0
2012-07-10T00:11:00.000
python,wxpython,wxwidgets
Embed .exe in wxpython
0
1
2
11,411,866
1
0
0
I'm new to programming and was wondering how I can have a python program execute and communicate with a c program. I am doing a mathematical computation in python, and was wondering if I could write up the main computation in C, that way the computation runs faster. I've been reading about "calling c functions from python", "including C or C++ code directly in your Python code", and "using c libraries from python". Is this the same thing? I want a python program to execute a c program and receive the results. What does it mean to "call C library functions" from python? Would it allow the python script to use c libraries or allow the script to execute code within a c compiler? thanks
false
11,420,053
0.099668
0
0
2
There's also numpy which can be reasonably fast when dealing with "array operations" (sometimes called vector operations, but I find that term confusing with SIMD terminology). You'll probably need numpy if you decide to go the cython route, so if the algorithm isn't too complicated, you might want to see if it is good enough with numpy by itself first. Note that there are two different routes you can take here. You can use subprocess which basically issues system calls to some other program that you have written. This is slow because you need to start a new process and send the data into the process and then read the data back from the process. In other words, the data gets replicated multiple times for each call. The second route is calling a C function from python. Since Cpython (the reference and most common python implementation) is written in C, you can create C extensions. They're basically compiled libraries that adhere to a certain API. Then Cpython can load those libraries and use the functions inside, passing pointers to the data. In this way, the data isn't actually replicated -- You're working with the same block of memory in python that you're using in C. The downside here is that the C API is a little complex. That's where 3rd party extensions and existing libraries come in (numpy, cython, ctypes, etc). They all have different ways of pushing computations int C functions without you having to worry about the C API. Numpy removes loops so you can add, subtract, multiply arrays quickly (among MANY other things). Cython translates python code to C which you can then compile and import -- typically to gain speed here you need to provide additional hints which allow cython to optimize the generated code, ctypes is a little fragile since you have to re-specify your C function prototype, but otherwise it's pretty easy as long as you can compile your library into a shared object ... The list could go on. Also note that if you're not using numpy, you might want to check out pypy. It claims to run your python code faster than Cpython.
0
634
0
2
2012-07-10T18:59:00.000
python,c
executing c program from a python program
0
1
4
11,420,313
1
1
0
I am capturing mobile snapshot(android) through monkeyrunner and with the help of some python script(i.e. for socket connection),i made it to display in an html page.but there is some time delay between the image i saw on my browser and that one on the android device.how can i synchronise these things so that the mobile screen snapshot should be visible at the sametime on the browser.
false
11,427,168
0.197375
0
0
1
It takes time for the image to get from your phone to your server to your desktop client. There's nothing you can do to change that. The best you can hope to do is to benchmark your entire application, figure out where are your bottlenecks, and hope it's not the network connection itself.
0
41
0
0
2012-07-11T06:57:00.000
javascript,python
how to darw the image faster in canvas
0
1
1
11,427,225
1
0
0
By easier i mean - can i define a style or something and apply it to all labels in my program? I have a lot of labels in it and I don't want to type so much. I heard about "Pango Style" but can I apply it to all label widgets at once?
false
11,437,350
0
0
0
0
The term: "lot of labels" is relative. Are we talking about 14 or 84? If it's closer to 84 you should probably be using Glade to create the interface then set the frames x-pad and y-pad properties. With CSS for gtk3 you'll have to pack any label in a frame for margin, padding or any of their variants (margin-top, padding-bottom) to work. A GtkFrame is a child of GtkMisc. GtkMisc has the function gtk_misc_set_padding(). You can use that function on your labels without packing them into frames. But you'd have to set it for each label. I don't know Python only C and some C++ but you could do something like this: 1) create a enum for all your labels starting with label0. (namedtuple in python I think) The reason I say to use an enum is that it's going to get very difficult later to keep track of all the labels without them. 2) create an array of pointers to GtkWidget, one for each label. 3) create your labels using the pointers to GtkWidget with the enum as the index. (here's where the enum is really needed) 4) create a for loop with gtk_misc_set_padding() in it. Use the GtkWidget array as the parameter in gtk_misc_set_padding(). Loop through each label, setting its padding. I could provide a example but it would probably wouldn't be useful if you don't know C. If you'd still like it let me know.
0
929
0
0
2012-07-11T16:39:00.000
python,label,border,gtk3
Is there a easier way of creating a bordered Label in python Gtk3 than putting it in Frame?
0
1
2
11,618,562
1
0
0
I am using the grid manager and have two frames side by side, and five columns with 1 button in each below the two frames in a second row, evenly spaced. All use "sticky" NSEW since I want them to scale proportionally if I enlarge the window. When I add a text entry widget to the right frame, it distorts the buttons below them so they are larger than those to the left. I can't figure out how to prevent this distortion, or put another way, how to keep each column the same size. Is there a reason why the text entry widget is not respective the row/col/weighting? Thanks in advance!
false
11,464,608
0
0
0
0
I think this is due to the fact you've given the entry widget a specific width (or are accepting the default). Since the widget wants to be a particular size, it will cause the column to grow in order to fit the requested size of its children. One solution is to set the size of the entry widget to 1. Then, because of the sticky settings for E and W, it will expand to exactly fit the column.
0
2,171
0
0
2012-07-13T05:25:00.000
python,tkinter
Tkinter - text widget distorting column sizes
0
2
3
11,473,405
1
0
0
I am using the grid manager and have two frames side by side, and five columns with 1 button in each below the two frames in a second row, evenly spaced. All use "sticky" NSEW since I want them to scale proportionally if I enlarge the window. When I add a text entry widget to the right frame, it distorts the buttons below them so they are larger than those to the left. I can't figure out how to prevent this distortion, or put another way, how to keep each column the same size. Is there a reason why the text entry widget is not respective the row/col/weighting? Thanks in advance!
false
11,464,608
0
0
0
0
In each frame you should set the "propagate" status to false, this will keep the frame from resizing based on what is inside. So if the frame uses grid() set grid_propagate(False) and so on.
0
2,171
0
0
2012-07-13T05:25:00.000
python,tkinter
Tkinter - text widget distorting column sizes
0
2
3
11,470,343
1
0
0
I am launching IronPython 2.7.3 on Windows 7 and it is taking more than 15 seconds. Why is it so slow? And how to fix it? The computer is a Samsung NP300E5A(Celeron B800,2gb) notebook.
true
11,475,925
1.2
0
0
5
There are a few reason why IronPython is slow to startup. First, if you didn't use the installer (which will ngen the assemblies), the JIT compiler has to convert the IronPython assemblies from MSIL bytecode to native code, and that takes time, as it's a lot of code. So use the installer on manually ngen the assemblies. Second, the actual Python code is also JIT compiled, although not right away to reduce the penalty; startup time used to be much worse when all Python code was JITted. The .NET JIT isn't fast enough for my liking. Finally, it's not a powerhouse of a laptop. That said, even on my SSD-equipped quad core it still takes a few seconds to get started. IronPython's startup time has improved a lot, to the point where it's now really hard to optimize further - profiling is hard (small sample size) and there's no obvious wins. It's "uniformly slow code" now, unfortunately. IronPython's strength right now lies in long-running processes where the JIT can get some big wins, and not in short ones where it's more of a hindrance.
0
345
0
2
2012-07-13T18:06:00.000
python,ironpython
IronPython launching very slowly
0
1
1
11,476,423
1
0
0
I am trying to make a GUI interface using PyQt4. I want to be able to send text from my python program and have it be displayed on a window created by PyQt4. I've been able to input data via a push button, but I would like to be able to write it from my python program. I can create a window using the self.setGeometry command, and I am fairly sure that the functions I need for writing blocks of text are in the QTextEdit Module (not QLabel, because that's for 1-line sections of text). The problem is that there are so many functions to use, and I'm new to PyQT (and Python in general, actually) so I don't understand the structure very well yet. Any help in the right direction would be appreciated!
false
11,477,308
0
0
0
0
QLabel is used to display texts while QTextEdit is mostly used to get one-line inputs of the user. e.g a form field to indicate that a name must be typed into the input area, QLabel is used as Name : and the QTextEdit is where the user will type in. But i think you should first check out layouts and placing methods on PyQt (Qt mostly) and then try create simple GUIs by hand so that'll make you learn basics and all other great tools of Qt, easily. There is also tool called Qt Designer which is very handy to creat GUIs for PyQt ( & Qt) programs by drag & drop tools.
0
3,600
0
0
2012-07-13T19:43:00.000
python,user-interface,pyqt4
Displaying text in a window with PyQT4
0
1
1
11,477,562
1
0
0
If I have a button that executes a handler in relation to one toplevel window or root - can it modify a widget in another toplevel? What is the standard method of doing this?
false
11,488,487
0
0
0
0
Yes, a handler for a button (or any event) can modify any widget in any other toplevel. As long as that handler has a reference to the widget, the handler can modify it. There are no restrictions in that regard.
0
463
0
0
2012-07-15T00:35:00.000
python,tkinter
Tkinter toplevel communication
0
1
2
11,491,757
1
0
0
I am looking for a way to play video streams with python. I couldn't find anything nice, so I ended up embedding webkit inside a gtk window, and streaming the video in there. it works well, but feels rather hacky to me. So, my question(s): Is there any other way to stream video (youtube, justin tv) using python and gtk? If not, is there a way to make my code run on Windows? Currently it only runs on Linux, I suspect because of a lack of Flash support for GTK on windows. Are there any efforts being made to fix this?
true
11,502,928
1.2
0
0
0
ALright, I've come up with an answer. Instead of using webkit, which doesn't seem to have flash support on windows, I'm gonna use the chromium embedded framework. It should let me do what I need to do, which is embed flash in a desktop app, whilst also allowing for the option of a html based interface. It's open source, and supports flash on windows(and linux, I believe).
0
551
0
2
2012-07-16T11:01:00.000
python,windows
Embeding flash in WebKit for pygtk on windows
0
1
2
11,557,820
1
0
0
So I made a game in PHP that worked fairly well, a simple game fairly similar to tic-tac-toe, I didn't really want to go much further with PHP improving the game. With that in mind I decided to learn Python; I'm familiar with the basics now. I used simple math, dictionaries and conditional statements to create a mock-up of my game. However it is turn based and I'd prefer the two players not be on the same computer physically taking turns with the computer. So what I envision my final product to be is a stand-alone app which each user has on their computer, they execute the app and enter a username then are brought to a screen where other users are, who have logged in as described, from there two users could mutually agree to start a round of the game, after completion they will be brought back to the 'waiting room' Now for something like this would I need (or be greatly helped by) a framework? If so which one(s)? Would this need a database on a server, or could all data be stored on the user's computers? Would I be dealing with CGI or Sockets or both in creating something like this? Would making this game into a web-app be easier? (similar to something I would create if I used PHP and ran the game off of a website) I would appreciate reading material on the subject. A link to an example source-code that solves a problem similar to what I have gets a gold star =) Thank you all for you time, I greatly appreciate everything.
true
11,534,826
1.2
1
0
2
General Response Especially if you include a "waiting room" and such things/ want this to be widely usable, this is a rather big project (definitely not a bad thing, but you may want to do some small projects first to get your feet wet with python programming for the web). However, it is relatively easy to have a simple terminal-based, turn-based game that transmits data over the network between its players; I'd focus on making the simple version first to get a feel for what is involved. That being said, here are some answers to the specific questions you asked; unfortunately they can't be too detailed, because there is so much to learn about these topics. Specific Answers Now for something like this would I need (or be greatly helped by) a framework? If so which one(s)? There are frameworks that would help with several different parts of this project, but you have some big design decisions to make before you start looking into frameworks to help with the implementation. Would this need a database on a server, or could all data be stored on the user's computers? Having a "waiting room" implies that there is some kind of server set up to facilitate making connections between players. Whether a database is necessary depends entirely on the scale of the application. If you want to keep track of users/enable repeat logins, there's almost certainly a database involved. Would I be dealing with CGI or Sockets or both in creating something like this? Read more about what CGI and sockets are and think about this one. Would making this game into a web-app be easier? (similar to something I would create if I used PHP and ran the game off of a website) There seem to be more resources to help making a web app version, but there are a whole new set of challenges and perhaps even more new things to learn about. It depends partly on what you are already comfortable with. Making a web app and making a standalone app that uses the internet are, perhaps surprisingly, very different, but both will involve a lot of new learning. Conclusion Well, I hope that was helpful in some way. Best of luck!
0
1,912
0
0
2012-07-18T05:32:00.000
php,python,network-programming
Wanting to make a turn-based python game. Where do I go from here?
0
1
2
11,535,406
1
0
0
When I use something like Pythonwin I always have to highlight everything in the debugging window and press delete to get rid of everything. Is there a way to make the program autoclear the debug window?
false
11,565,271
0.132549
0
0
2
For clarity to anyone who comes across this old question. PythonWin's interactive shell window can be cleared by highlighting all the text and then pressing delete just like it were a text editor.
0
1,178
0
1
2012-07-19T16:30:00.000
python
Clearing screen in Python (when using Pythonwin)
0
1
3
36,500,008
1
0
0
I can see how to cut and paste nodes in a tree or move them up and down using buttons or key bindings. Is there a way to implement dragging and dropping nodes around the treeview?
true
11,570,786
1.2
0
0
6
You will have to set this up yourself, but it's definitely possible. You'll simply need to make appropriate bindings for <ButtonPress-1> (identify the item to be dragged), <ButtonRelease-1> (implement the drop), and <B1-Motion> (provide feedback during the drag)
0
4,459
0
5
2012-07-19T23:28:00.000
python,tkinter
tkinter treeview - drag and drop?
0
2
3
11,580,799
1
0
0
I can see how to cut and paste nodes in a tree or move them up and down using buttons or key bindings. Is there a way to implement dragging and dropping nodes around the treeview?
false
11,570,786
0.26052
0
0
4
Could not leave comment on solution so added my 50c here: to resolve the issue dragging via multilevel tree up and down, you need to specify the parent ID when moving, as per line below: tv.move(s, tv.identify_row(event.y), moveto) this might be usefull for someone...
0
4,459
0
5
2012-07-19T23:28:00.000
python,tkinter
tkinter treeview - drag and drop?
0
2
3
41,599,442
1
0
0
I am making a music player in python/wxpython. I have a listbox with all the songs, and the music player plays the selected song. I am now trying to make a "next button" to select the next item in the listbox and play it. How would I go about doing that? Is there something like GetNextString() or something along those lines?
true
11,594,044
1.2
0
0
0
Not to my knowledge. Just keep track of the currently selected item's placement in the list and update it by incrementing or decrementing it.
0
58
0
0
2012-07-21T16:47:00.000
python,wxpython
how to select next item of wxlistbox in wxpython?
0
1
1
11,613,711
1
0
0
I am using a wx.grid in Python to display stock prices. After the value of a cell changes, I want to change the background and font color for a short period, say 0.5 seconds and then change it back to its original colors. If I do this in a straightforward way, I just change both colors, do a time.sleep(0.5) and change it back to its original colors. However, this way the update per cell takes way too long. Does anybody know of a clever way to do this?
false
11,599,942
0
0
0
0
Change the color and use wxTimerEvent to set the delay until you change it back in the event handler.
0
118
0
0
2012-07-22T11:35:00.000
python,wxpython
How to let a cell blink for a configurable time in wx.grid when the value changes?
0
1
1
11,603,933
1
0
0
I need to develop a GUI that works on both Windows and Linux, for a back-end that's written in C++ and runs on Linux only. I'm aware that I would need to use a wrapper (like Swig) if I opt for Java or Python but then again they're known to produce better GUIs than C++. What would you suggest as the better option (for a newbie)?
false
11,606,873
0.099668
0
0
1
Take a look at MonoDevelop. Allows you to develop in C# and deploy to both Linux and Windows.
0
259
0
0
2012-07-23T05:24:00.000
java,c++,python,user-interface
Better language for developing GUI?
0
1
2
11,606,887
1
0
0
I am writing an app which draws text and shapes in a ClientDC of a Frame. When I run the app under my Fedora 16(Gnome 3) nothing is drawn in the Frame, but if I run it under Windows all drawings display normally. I've tried using WindowDC to do the drawing on, but it is not different to ClientDC under Fedora. I can only get a successful drawing when using PaintDC. Am I doing something wrong(or missing something), or is it just Linux/Fedora/Gnome 3?
false
11,607,571
0.197375
0
0
1
I think the recommended way to paint is with the newer wx.GCDC with a fallback to the wx.PaintDC. If you need advanced drawing, see FloatCanvas, cairo or the glcanvas.
0
76
1
0
2012-07-23T06:42:00.000
linux,wxpython,fedora,gnome-3,gdi
ClientDC and WindowDC do not draw under Fedora 16 Gnome 3, only PaintDC
0
1
1
11,617,941
1
0
0
I have a window that is split to have a custom tree ctrl on left panel and a grid table on the right. Now I want the grid table to display the information in such a way that first few columns freeze (not scroll) while the remaining data has an option to scroll horizontally. I have no clue how to proceed, please help. I have seen that splitter window can be of some help, can someone provide a sample code.
false
11,628,835
0
0
0
0
wx.FreezeTo(row,col) 0 to unfreeze, otherwise any other number will freeze the first rows or columns
0
751
0
2
2012-07-24T10:24:00.000
wxpython
Freeze few column in wxgrid
0
1
2
64,290,241
1
0
0
I'm reading a tutorial on PySide and I was thinking , do I need to find my own icons for every thing or is there some way to use some built in icons . That way I wouldn't need to find an entire new set of icons if I want my little gui to run on another desktop environment .
false
11,643,221
0
0
0
0
in PyQt, the window icon is by default the Qt logo. I think you will have to find your own icons for things inside the gui.
0
30,098
0
28
2012-07-25T05:21:00.000
python,user-interface,icons,pyqt,pyside
Are there default icons in PyQt/PySide?
0
1
8
11,693,002
1
0
0
Can anybody explain me difference between wxpython and tkinter? Which one is the best for development? I want to develop a media player using python.
false
11,684,796
0.197375
0
0
1
these are two different widget libraries. TkInter is built-in, however, as far as I remember, it translates python statements to tcl statements, which might not make it fast. It's also looking like a tcl/tk application on all platforms. wxpython is NOT built-in, therefore you have to distribute it with your code to all platforms, albeit it 'blends in' a bit more perhaps. It depends on your needs of course. I've seen a lot of apps using XULRunner with python, examples are Miro and Songbird, but there are ones which are using gnome/gtk as well I guess. Depends on which platforms do you want to support...
0
1,691
0
0
2012-07-27T09:10:00.000
python
Difference between wxpython and tkinter
0
1
1
11,684,911
1
0
0
How to create a readonly multicolored text widget like a StyledTextCtrl, but without scrollbars, borders etc? It should be just a widget that allows to paint different parts of text by different colors, nothing more... Maybe wxPython is not the best solution for it?
false
11,694,213
0
0
0
0
You could use a wx.TextCtrl with the TE_RICH style flag and set it up so it doesn't have any borders. Or you could use the HTMLWindow.
0
111
0
0
2012-07-27T19:11:00.000
wxpython
wxPython: Create multicolored text widget for ASCII game
0
1
1
11,722,723
1
0
0
I have successfully outsourced an expensive routine in my PyQT4 GUI to a worker QThread to prevent the GUI from going unresponsive. However, I would like the GUI to wait until the worker thread is finished processing to continue executing its own code. The solution that immediately comes to my mind is to have the thread emit a signal when complete (as I understand, QThreads already do this), and then look for this signal in the main window before the rest of the code is executed. Is this hacked? I know QThread provides the wait() function described here , but the usage is unclear to me. I think I want to call this on the main thread, but I'm not sure how to call that in my app...?
false
11,695,649
0.099668
0
0
1
This is a really bad plan. Split up the 'before thread action' and 'after thread action'. The 'after thread action' should be a slot fired by a QueuedConnection that the thread can signal. Do not wait in GUI event handlers!
0
330
0
1
2012-07-27T21:06:00.000
python,pyqt4,qthread,python-multithreading
How do I tell my main GUI to wait on a worker thread?
0
2
2
11,695,734
1
0
0
I have successfully outsourced an expensive routine in my PyQT4 GUI to a worker QThread to prevent the GUI from going unresponsive. However, I would like the GUI to wait until the worker thread is finished processing to continue executing its own code. The solution that immediately comes to my mind is to have the thread emit a signal when complete (as I understand, QThreads already do this), and then look for this signal in the main window before the rest of the code is executed. Is this hacked? I know QThread provides the wait() function described here , but the usage is unclear to me. I think I want to call this on the main thread, but I'm not sure how to call that in my app...?
false
11,695,649
0
0
0
0
If the GUI thread called the wait() function on the worker thread object, it would not return from it until the worker thread returns from its main function. This is not what you want to do. The solution you describe using signal and slots seems to make plenty of sense to me. Or you could just use a boolean.
0
330
0
1
2012-07-27T21:06:00.000
python,pyqt4,qthread,python-multithreading
How do I tell my main GUI to wait on a worker thread?
0
2
2
11,695,743
1
0
0
I'm just beginning to learn programming (on C++ and Python), and by beginning I mean total beginning ("hello world" beginning...). Not wanting to use multiple IDE's, I would like to be able to code and build–simple–programs with my text editor, Sublime Text 2. Could someone indicate me, with a step-by-step tutorial, how to implement C++ and Python compiling and executing capabilities in Sublime Text. I've searched Sublime Text build systems on the site, but the answers are very specific and can't help a rookie like me (but they'll probably help me later). Thanks
false
11,729,368
0.099668
0
0
2
windows(install minigw, python2.7 and added to the system path) cpp: build: ctrl+b run: ctrl+shift+b python: build and run: ctrl+b you may try to learn the the .sublime-build files in your Tools -> Build system -> New build system
0
79,860
0
25
2012-07-30T20:51:00.000
c++,python,build,sublimetext2
Build systems in Sublime Text
0
1
4
14,229,213
1
0
0
I have gone through a few tutorials regarding console Python applications. I am using vim and using the Windows command prompt to run my same applications. I am moving towards GUI creation in wxPython. I am essentially trying to recreate the google finance chart, but with data from some temperature sensors. However, whenever I run the program from the command line, the window of my sample app flashes and goes away immediately. When I ran it through IDLE, I saw that there was an error in my code. Is there a way to see errors when I run it from the command line, because I am much more comfortable with vim? Thanks in advance!
false
11,740,489
0
0
0
0
Telling the program to request input from the console at the end via raw_input() should cause it to pause before closing the console.
0
293
0
3
2012-07-31T12:50:00.000
python,user-interface,vim,command-line-interface
Python GUI creation
0
2
2
11,740,644
1
0
0
I have gone through a few tutorials regarding console Python applications. I am using vim and using the Windows command prompt to run my same applications. I am moving towards GUI creation in wxPython. I am essentially trying to recreate the google finance chart, but with data from some temperature sensors. However, whenever I run the program from the command line, the window of my sample app flashes and goes away immediately. When I ran it through IDLE, I saw that there was an error in my code. Is there a way to see errors when I run it from the command line, because I am much more comfortable with vim? Thanks in advance!
true
11,740,489
1.2
0
0
1
You can run the code, using commands in cmd prompt "Python.exe filename.py", as it shouldn't exit the cmd prompt upon the execution of the code. Or you can write the program in vim and run it through IDLE.
0
293
0
3
2012-07-31T12:50:00.000
python,user-interface,vim,command-line-interface
Python GUI creation
0
2
2
11,741,077
1
0
0
I am not familiar with what C# can do, especially in the context of a Xbox 360 game, but is it possible to execute Python scripts from within an Xbox 360 Indie game? I've read several times that you'd want to write the game graphics and logic in a quicker language like C#, and then use Python as a scripting language for fast iteration. Is this sort of thing possible for development on the Xbox 360 platform?
false
11,769,445
0
0
0
0
Well although C++ is the language of choice for gaming industry, I have seen really good games written in C# using the XNA framework. In terms of your scripting question, I believe Blizzard uses Lua for UI in games like WoW. But going back to your question it's possible to have Python integrated to C#, there is an open-source implementation of the Python programming language which is tightly integrated with the .NET Framework called IronPython.
1
734
0
1
2012-08-02T00:26:00.000
c#,python,xbox360
Using C# to write an Xbox 360 Indie game with Python Scripting
0
1
2
11,769,529
1
0
0
I have a wxPanel. How can I make it resizable by the user? With a drag-and-drop resize bar? I wonder what the widgets I need are. Thank you.
false
11,780,084
0.099668
0
0
1
A Panel floating all by itself? Doesn't sound too likely! It would be a lot easier to answer this question if you described in more detail what you are doing, and what is not working as you expect. In general, panels are created as children of a frame. If the panel is the ONLY child of the frame, then it will be resized automatically along with the frame. Otherwise you will have to handle the resize event yourself. What have you tried so far?
0
2,621
0
1
2012-08-02T14:50:00.000
python,wxpython,wxwidgets
Make a wxPanel resizable by the user
0
1
2
11,780,276
1
0
0
My goal is to capture frames from a webcam as efficiently as possible using OpenCV. At the moment I'm able to capture 30FPS 6408*480 drawing directly onto a wxPython panel using the standard drawing context (BufferedPaintDC), with about 15% CPU usage (older Core Duo processor). What I'm curious is what sort of performance boost (if any) I'll see if I embed a PyGame canvas within a wxPython frame, and draw directly to the PyGame canvas. What I'm not sure about is whether the bottleneck is the wxPython frame, and if embedding a PyGame canvas will actually do anything. Or does the wxPython frame act simply like a container and has no influence on the PyGame canvas? I'm hoping I'm making sense here. The other option would be to use PyGame exclusively, however I really like the functionality of the wxPython widgets, so I'd hate to lose that. Or is there a faster canvas that I can integrate into wxPython that I'm not aware of? Thoughts? Thanks.
false
11,820,258
0
0
0
0
I don't know why you'd want to embed a gaming library into wxPython in the hopes of gaining a performance boost. Personally, I don't think that will happen. You should take a look at the currently supported drawing canvases that wxPython provides instead or explain what you're trying to do. People have done in games in wxPython... Anyway, the main drawing interfaces for wx today are wx.GCDC / wx.GraphicsContext, cairo, FloatCanvas, or GLCanvas. Of course, there are also wx.DC, wx.PaintDC and the one you found as well.
0
528
0
1
2012-08-05T21:34:00.000
python,opencv,wxpython,pygame
wxPython, or PyGame canvas within wxPython -> which is faster?
0
1
1
11,833,097
1
0
0
I wrote a pure python TIFF G4 decompress for use with tifffile.py. I know there are ways to add libtiff to a custom PIL, but I never could get that working very well in a mixed virtualenv. I want to manipulate the image in PIL. I am looking for pointers in hooking my decompressor to stock PIL for TiffImagePlugin.py. Any ideas?
true
11,868,963
1.2
0
0
0
It appears that TiffImagePlugin does not easily allow me to hook in additional decompressors. Replacing TiffImageFile._decoder with a dictionary of decoders might work, but you would have to examine and test each release of PIL to ensure it hasn't broken. This level of maintenance is just as bad as a custom PIL. I appreciate the design of tifffile.py for using a dictionary of decoders. It made it very easy. Final solution? I couldn't hook my code into PIL. I had to use PIL.Image.fromarray() to using my decompressed images.
1
973
0
1
2012-08-08T16:27:00.000
python,python-imaging-library,tiff
Using TIFF G4 image in PIL
0
1
1
11,877,012
1
0
0
I'm making a few Python applications for MacOSX (10.6 in this case, though I don't imagine it matters) using Tkinter to code the interface, and py2app to create the bundle. As many of you know, these stand-alone apps tend to be a fairly large size, about 70-80 MB, mostly because I am using numpy. As expected, 23 MB of this is from numpy (which must remain uncompressed to function), but I found that 30 MB is from the Tcl framework at Contents/Frameworks/Tcl.framework, and 5 MB is from the Tk framework. For the hell of it I tried compressing both of these folders, which brought them down to 9 MB and 1 MB, respectively. Now the application is almost half its original size, and as far as I can tell everything is working perfectly. My question is to the Tkinter/application gurus out there: Is this bad? Is there any reason that I shouldn't be compressing these frameworks? Could this impact distribution in any way? And if not, why doesn't py2app do this natively? EDIT: I tried actually removing both the Tcl and the Tk frameworks from my application bundle, and everything still works fine. Why are these here if they aren't used with tkinter?
true
11,906,505
1.2
0
0
1
It's probably continuing to work because it's using your frameworks to load Tkinter instead of the bundled ones. If you moved it to another computer without Tkinter, it might not launch or could just crash right away.
0
151
0
0
2012-08-10T17:28:00.000
python,tkinter,py2app
Saving space in tkinter application
0
1
1
11,906,589
1
0
0
I started a project where you can "log in" on a terminal (basically a Raspberry Pi with a touchscreen attached) with a wireless token (for time tracking). What will be the best and fastest solution to display the status (basically a background picture and 2-3 texts changing depending on the status of the token) on the screen (fullscreen)? I tried it web-based with chromium, which is -very- slow... It has to be easy to do http request and en-/decoding JSON - and please no C/C++. Maybe python + wxwidgets?
false
11,907,027
0.197375
1
0
3
You could use Python for this easily with just the standard library (python 2.7.3). For the GUI you can use Tkinter or Pygame (not standard library) which both support images and text placement (and full screen). It is notable that Tkinter is not thread safe, so that may be a problem if your planning on threading this program. For the http request you can use httplib. For the Json related things you can use the json library.
0
3,021
0
3
2012-08-10T18:09:00.000
python,user-interface,raspberry-pi
fast gui on raspberry
0
1
3
11,907,139
1
0
0
I am writing an application in Qt that I want to extend with plugins. My application also has a library that the plugins will use. So, I need a 2 way communication. Basically, the plugins can call the library, and my application which loads the plugins will call them. Right now, I have my library written in C++, so it has some classes. The plugins can include the header files, link to it and use it. I also have a header file with my interface, which is abstract base class that the plugins must have implemented. They should also export a function that will return a pointer to that class, and uses C linkage. Up to this point I believe that everything is clear, a standard plugin interface. However, there are 3 main problems, or subtasks: How to use the library from other languages? I tried this with Python only. I used SIP to generate a Python component that I successfully imported in a test.py file, and called functions from a class in the library. I haven't tried with any other language. How to generate the appropriate declaration, or stub, for my abstract class in other languages? Since the plugins must implement this class, I should be able to somehow generate an equivalent to a header in the other languages, like .py files for Python, .class files for Java, etc. I didn't try this yet, but I suppose there are generators for other languages. How am I going to make instances of the objects in the plugins? If I got to this point the class would be implemented in the plugins. Now I will need to call the function that returns the instance of the implemented abstract class, and get a pointer to it. Based on my research, in order to make this work I will have to get a handle to the Python interpreter, JVM, etc., and then communicate with the plugin from there. It doesn't look too complex, but when I started my research even for the simplest case it took a good amount of work. And I successfully got only to the 1st point, and only in Python. That made me wonder if I am taking the right approach? What are your thoughts on this.. maybe I should not have used Qt in my library and the abstract base class, but only pure C++. It could probably make the things a bit easier. Or maybe I should have used only C in my library, and make the plugins return a C struct instead of a class. That I believe would make the things much easier, since calling the library would be a trivial thing. And I believe the implementation of a C struct would be much easier that implementing C++ class, and even easier that implementing a C++ class that uses Qt objects. Please point me to the right direction, and share your expertise on this. Also, if you know of any book on the subject, I'd be more than happy to purchase it. Or some links that deal with this would do.
false
11,914,614
0.197375
1
0
1
C++ mangles its symbols, and has special magic to define classes, which is sort of hacked on top of standard (C) object files. You don't want your files from other languages to understand that magic. So I would certainly follow your own suggestion, to do everything in pure C. However, that doesn't mean you can't use C++. Only the interface has to be C, not the implementation. Or more strictly speaking, the object file that is produced must not use special features that other languages don't use. While it is possible for a plugin to link to your program and thus use functions from it, I personally find it more readable (and thus maintainable) to call a plugin function after loading it, passing an array of function pointers which can be used by the plugin. Every language has support for opening shared object (SO or DLL) files. Use that. Your interface will consist of functions which have several arguments and return types, which probably have special needs in how they are passed in or retrieved. There probably are automated systems for this, but personally I would just write the interface file by hand. The most important is that you properly document the interface, so people can use any language they want, as long as they know how to load object files from their language. Different languages have very different ways of storing objects. I would recommend to make the creator of the data also the owner of the memory. So if your program has a class with a constructor (which is wrapped in C functions for the plugin interface), the class is the one creating the data, and your program, not the plugin, should own it. This means that the plugin will need to notify your program when it's done with it and at that point your program can destroy it (unless it is still needed, of course). In languages which support it, such as Python and C++, this can be done automatically when their interface object is destroyed. (I'm assuming here that the plugin will create an object for the purpose of communicating with the actual object; this object behaves like the real object, but in the target language instead of C.) Keep any libraries (such as Qt) out of the interface. You can allow functions like "Put resource #x at this position on the screen", but not "Put this Qt object at this position on the screen". The reason is that when you require the plugin to pass Qt objects around, they will need to understand Qt, which makes it a lot harder to write a plugin. If plugins are completely trusted, you can allow them to pass (opaque) pointers to those objects, but for the interface that isn't any different from using other number types. Just don't require them to do things with the objects, other than calling functions in your program.
0
308
0
3
2012-08-11T12:15:00.000
java,c++,python,qt,plugins
How to write Qt plugin system with bindings in other languages?
0
1
1
13,563,225
1
0
0
I love both python and Qt, but it's pretty obvious to me that Qt was not designed with python in mind. There are numerous ways to crash a PyQt / PySide application, many of which are extraordinarily difficult to debug, even with the proper tools. I would like to know: what are good practices for avoiding crashes and lockups when using PyQt and PySide? These can be anything from general programming tips and support modules down to highly specific workarounds and bugs to avoid.
false
11,945,183
0
0
0
0
Emitting signals instead of synchronic UI control was the key to avoid problems for me during implementation of logic circuit simulator
1
14,012
0
39
2012-08-14T02:56:00.000
python,pyqt,pyqt4
What are good practices for avoiding crashes / hangs in PyQt?
0
1
4
66,418,264
1
0
0
I am thinking of writing a python program that runs in the background and can inspect user's GUI events. My requirements is very simple: 1) When user right click the mouse, it can show an option; and when this option is chosen, my program should know this event. 2) When user select a file and click some predefined key combination, my program should know this event. What should I do? Is this a GUI program? I am also thinking that, this program maybe a daemon on the machine and can inspect the user's GUI event, but I am not sure how can I do this. Thanks.
false
11,970,246
0.197375
0
0
2
If you're talking about doing this stuff inside of a wxPython program, then it's all pretty simple. There's a PopupMenu widget for the first one and an AcceratorTable for the second one. If you're wanting to catch mouse and keyboard events outside of a wxPython program, then you have to go very low-level and hook into the OS itself, which means that there really isn't any good way to do it cross-platform. You'll probably want to look at ctypes and similar libraries for that sort of thing.
0
367
0
0
2012-08-15T13:35:00.000
python,wxpython
Background python program inspect GUI events
0
1
2
11,975,689
1
0
0
I work as a test engineer. I have to test an application(softphone) which is done by using QWidget. I'm using python - pywinauto. I can click buttons and make calls. There is a qwidget object named with statusLabel. At the beginning of the test, "Ready" text written on it. When I make a call, this text is changed like "Calling..", "Call Established" and so on. I want to check the text of that widget. Do you have any idea?
true
11,983,110
1.2
0
0
1
Pywinauto uses standard windows API calls. Unfortunately many UI libraries (like Swing/QT/GTK) do not respond in a typical way to the API calls used - so unfortunately pywinauto often cannot get the control information. (P.s. I am the Author of pywinauto).
0
874
0
1
2012-08-16T08:14:00.000
python,testing,qwidget,pywinauto
find qwidget object text by using pywinauto
0
1
1
12,048,666
1
0
0
I am making an interface in Tkinter and I need to have custom fonts. Not just, say, Helvetica at a certain size or whatever, but fonts other than what would normally be available on any given platform. This would be something that would be kept with the program as an image file or (preferably) Truetype font file or similar. I don't want to have to install the desired fonts on every machine that is going to use the program, I just want to carry them around with the program in the same directory. The tkFont module looks like it ought to do something like this, but I can't see where it would take a filename for a font not normally accessible to the system running the program. Thanks in advance for your help.
false
11,993,290
1
0
0
7
There is no way to load an external font file into Tkinter without resorting to platform-specific hacks. There's nothing built-in to Tkinter to support it.
0
20,715
0
22
2012-08-16T18:30:00.000
python,fonts,tkinter
Truly custom font in Tkinter
0
1
7
11,995,850
1
0
0
I am designing a software in Python using WxPython as GUI in Windows.I want to change the default colour of Gauge Progress bar in my application. Please help... Thanks in advance..
true
12,006,741
1.2
0
0
2
You can try something like SetForegroundColour or SetBackgrounColour, but since the gauge wraps the native widget, I'm not sure that those will have any effect. Fortunately, there is a generic gauge widget called PyGauge: wx.lib.agw.pygauge I don't think it's quite as pretty as the native one, but you can definitely change the color. There are a couple examples of PyGauge in the wxPython demo package.
0
1,303
0
1
2012-08-17T13:26:00.000
python,user-interface,python-3.x,wxpython
Wxpython How to change the colour of Gauge Progress bar in windows
0
1
1
12,008,375
1
0
0
I have a python-tkinter gui app that I've been trying to find some way to add in some functionality. I was hoping there would be a way to right-click on an item in the app's listbox area and bring up a context menu. Is tkinter able to accomplish this? Would I be better off looking into gtk or some other gui-toolkit?
false
12,014,210
0
0
0
0
Important Caveat: (Assuming the event argument that contains the coordinates is called "event"): Nothing will happen or be visible when you call tk_popup(...) unless you use "event.x_root" and "event.y_root" as arguments. If you do the obvious of using "event.x" and "event.y", it won't work, even though the names of the coordinates are "x" and "y" and there is no mention of "x_root" and "y_root" anywhere within it. As for the grab_release(..), it's not necessary, anywhere. "tearoff=0" also isn't necessary, setting it to 1 (which is default), simply adds a dotted line entry to the context menu. If you click on it, it detaches the context menu and makes it its own top-level window with window decorators. tearoff=0 will hide this entry. Moreover, it doesn't matter if you set the menu's master to any specific widget or root, or anything at all.
0
45,627
0
31
2012-08-17T23:04:00.000
python,user-interface,tkinter,contextmenu
tkinter app adding a right click context menu?
0
1
4
69,902,726
1
0
0
I'm looking to make a 2d side scrolling game in Python, however I'm not sure what library to use. I know of PyGame (Hasn't been updated in 3 years), Pyglet, and PyOpenGL. My problem is I can't find any actually shipped games that were made with Python, let alone these libraries - so I don't know how well they perform in real world situations, or even if any of them are suitable for use in an actual game and not a competition. Can anyone please shed some light on these libraries? Is PyGame still used effectively? Is Pyglet worth while? Have either of them been used to make a game? Are there any other libraries I'm forgetting? Honestly I'm not even sure I want to use Python, it seems too slow, unproven (For games written solely in Python), etc.... I have not found any game that was made primarily in Python, for sure, that has been sold. If I don't end up going with Python, what would a second/better choice be? Java? LUA?
false
12,016,443
0.066568
0
0
1
Pygame should suffice for what you want to do. Pygame is stable and if you look around the websites you will find games which have been coded in pygame. What type of game are you looking to implement?
1
6,320
0
1
2012-08-18T06:32:00.000
python,pygame,game-engine,pyglet
Making a 2d game in Python - which library should be used?
0
1
3
12,016,497
1
0
0
When I convert a file with 158 pixel to pdf file, I just got a pdf file with 121 pixel in 100% zoom. wkhtmltopdf --dpi 100 c:\1.svg c:\2.pdf when I change the DPI, I find't it doesn't work. --dpi 100 is the same as --dpi 1000. wkhtmltopdf version is 0.11, test under windows and linux.
false
12,027,081
0.664037
0
0
4
Try with the --disable-smart-shrinking option
0
1,365
0
1
2012-08-19T14:03:00.000
php,python,wkhtmltopdf
using wkhtmltopdf convert a file to pdf is smaller in size than the real file
0
1
1
12,590,770
1
0
0
Is there anyway to assign priorities to specific wxPython event? I periodically call a method using a timer after starting my GUI. But I want to be able to get out of this method as soon as the user presses a button. Is this possible without having a worker thread?
false
12,054,994
0.197375
0
0
1
Not that I'm aware of. The events are added to the event queue in the order they are received. You might be able to do this with a thread where the process is running in the thread and you kill it. You might try asking on the wxPython mailing list for other ideas though. A couple of the core developers are there and they might have some insights for you.
0
264
0
2
2012-08-21T12:37:00.000
python,wxpython,wxwidgets
Assigning priorities to wxPython events
0
1
1
12,056,334
1
0
0
I'm coding a game using wxpython with multiple *.py scripts and I would like to, when I press a button from the main script, another script is launched. Example: I launch a *.py script for the game menu window that has multiple options. When I press the options button, it will launch an other script that was assigned to that button an open the options window How can I do that? Thx
false
12,060,442
0
0
0
0
have you tried using subprocess? you can assign button event to subprocess to launch another py script.
0
3,498
0
1
2012-08-21T17:59:00.000
python,wxpython
Open a py file from pressing a button on another py file
0
2
4
12,060,487
1
0
0
I'm coding a game using wxpython with multiple *.py scripts and I would like to, when I press a button from the main script, another script is launched. Example: I launch a *.py script for the game menu window that has multiple options. When I press the options button, it will launch an other script that was assigned to that button an open the options window How can I do that? Thx
false
12,060,442
0
0
0
0
well i'd recommend using os module for only in case you want to run an script till it's closed ,Or in other words like making the main script in the ground and focus in the option window use os.system('script_name.py') < in windows or os.system('python script.py') < in Linux after giving it the permission
0
3,498
0
1
2012-08-21T17:59:00.000
python,wxpython
Open a py file from pressing a button on another py file
0
2
4
12,060,881
1
1
0
Is there any add-on which will activate while uploading files into the Plone site automatically? It should compress the files and then upload into the files. These can be image files like CAD drawings or any other types. Irrespective of the file type, beyond a specific size, they should get compressed and stored, rather than manually compressing the files and storing them.I am using plone 4.1. I am aware of the css, javascript files which get compressed, but not of uploaded files. I am also aware of the 'image handling' in the 'Site Setup'
true
12,066,923
1.2
1
0
2
As Maulwurfn says, there is no such add-on, but this would be fairly straightforward for an experienced developer to implementing using a custom content type. You will want to be pretty sure that the specific file types you're hoping to store will actually benefit from compression (many modern file formats already include some compression, and so simply zipping them won't shrink them much). Also, unless you implement something complex like a client-side Flash uploader with built-in compression, Plone can only compress files after they've been uploaded, not before, so if you're hoping to make uploads quicker for users, rather than to minimize storage space, you're facing a somewhat more difficult challenge.
0
258
0
0
2012-08-22T05:42:00.000
python,plone
Is there an add-on to auto compress files while uploading into Plone?
0
1
1
12,079,431
1
0
0
I am using the Python C API and trying to create a function that will allocate new instances of PyTypeObjects to use in several C++ classes. The idea is that each class would have a pointer to a PyTypeObject that would get instantiated with this factory. The pointers must be static. However, I'm having issues with this approach. In the class that contains the pointer to the PyTypeObject, I get the "undefined reference" linker error when I try to set that static variable equal to the result of the factory function (which is in another class but is static). I suppose this makes sense because the function wouldn't happen until runtime but I don't know another way to do this. I don't know how to set the PyTypeObject fields dynamically because the first field is always a macro: PyObject_VAR_HEAD. Hope this makes sense. Basically, I'm trying to make it so several classes don't have to redefine PyTypeObject statically, but can instead instantiate their PyTypeObject variables from a factory function.
false
12,098,554
0
0
0
0
Try this: create a 'template' PyTypeObject, and use struct copying (or memcpy) to clone the basic template. Then you can fill it in with the requisite field definitions after that. This solves (2), since you only have to declare the full PyTypeObject once. For your first point, you just set the static variable from your module init instead of doing it in the static variable declaration. So, it won't be set until your module actually initializes. If you plan on doing this often, it may be worth looking at Boost::Python, which simplifies the process of generating CPython wrappers from C++ classes.
0
461
0
0
2012-08-23T19:17:00.000
python,c,api
Static factory for PyTypeObject
0
1
1
12,098,669
1
0
0
My question is a little bit stupid but I decided to ask advanced programmers like some of you. So I want to make a "dynamic" C++ program. My idea is to compile it and after compilation (maybe with scripting language like python) to change some how the code of the program. I know you will tell me that after the compilation I can not change the code but is there a way of doing that. Thank you!
true
12,105,775
1.2
1
0
3
The only way to do that in C++ is to unload the DLL with the code to be modified, modify the sources, invoke the compiler to regenerate the DLL, and reload the DLL. It's very, very heavy weight, and it only works if the compiler is present on the machines where the code is to be run. (Usually the case under Unix, rarely the case with Windows.) Interpreted languages like Python are considerably more dynamic; Python has a built-in function to execute a string as Python code, for example. If you need dynamically modifiable code, I'd suggest embedding Python in your application, and using it for the dynamic parts.
1
315
0
2
2012-08-24T08:32:00.000
c++,python,compilation
Using scripting language in C++
0
1
3
12,105,989
1
0
0
I just started to use Sublime Text 2. I use Sublime for python, but when I use CTRL+B it does not run my wxPython GUI app. It can run a Tkinter app. Why is this? What do I need to do to run a wxPython app from Sublime?
false
12,122,980
0.26052
0
0
4
Find the file named python.sublime-build under C:\Users[USER NAME]\AppData\Roaming\Sublime Text 2\Packages\Python\ Add the following value "shell":"true" Save the file and run your How to run a wxPython GUI app in Sublime Text 2!
0
3,053
0
8
2012-08-25T14:51:00.000
python,wxpython,sublimetext2
How to run a wxPython GUI app in Sublime Text 2
0
1
3
21,536,926
1
0
0
I'm thinking about Python and C/C++ combination to replace the original concept about OSGi + Java + JNI + C/C++ in our SW architecture. I definitely don't need to replace all features of such OSGi frameworks as Felix or Equinox. What I really will need in my Python code: Enabler of modularity for the application layer Component-based framework for applications Central registry of services/components Very lightweight framework, it will run on embedded devices (though pretty enough of RAM) Can you please advise on such Python framework?
false
12,163,104
0.099668
0
0
1
Peter already mentioned Apache Celix. Might be well worth to check it out. Part of Celix is a Remote Service Admin (RSA) implementation, making it possible to use it in a distributed environment. Eventually this implementation will also make it possible to communicate with a Java based OSGi framework, making Celix+RSA an alternative for JNI. This has the additional benefit that the native and java code don't share the same process. If one end runs into a problem, the other end still stays running. In line with Celix, you could as well look at Native-OSGi, this is an effort of Celix and some C++ OSGi like frameworks (CTK Plugin Framework and nOSGi) to come up with a combined approach for Native OSGi like implementations. This includes stuff like a well defined API, bundle format, code sharing etc. Looking at your requirements I thinks Celix and Native-OSGi might be a good fit.
0
2,706
0
3
2012-08-28T15:57:00.000
java,c++,python,osgi,modularity
Python framework as an alternative for "Java + OSGi" combination
0
2
2
12,191,011
1
0
0
I'm thinking about Python and C/C++ combination to replace the original concept about OSGi + Java + JNI + C/C++ in our SW architecture. I definitely don't need to replace all features of such OSGi frameworks as Felix or Equinox. What I really will need in my Python code: Enabler of modularity for the application layer Component-based framework for applications Central registry of services/components Very lightweight framework, it will run on embedded devices (though pretty enough of RAM) Can you please advise on such Python framework?
false
12,163,104
0.291313
0
0
3
I think much of what OSGi offers is closely related to the architecture of Java: its class loaders and type safety. Implementing a service registry should not be too hard but managing it with the accuracy of OSGi will be virtually impossible. Obviously the power of multiple namespace that OSGi offers will not work in Python unless you move the modules into separate processes which will require more expensive inter process communication for inter module communication. You could start with Apache Celix, which is native based but I have similar doubts about its utility since native code does not provide a lot of information about its dependencies. A more general solution is the original idea of Universal OSGi. In this model you keep the OSGi framework as it is for the deployment and management. However, you create handler bundles that can map a bundle written with other languages. E.g. a Python handler or C++ native. The handlers would map a native service registry model to the OSGi service registry. This is surprisingly easy to do since the OSGi service registry is properly evented. The native handlers would map the bundle events like start/stop to instruct the operating system to start/stop the native code.
0
2,706
0
3
2012-08-28T15:57:00.000
java,c++,python,osgi,modularity
Python framework as an alternative for "Java + OSGi" combination
0
2
2
12,172,339
1
0
0
How can I add extra data to wx.TextCtrl widgets? At the moment I'm using the GetToolTipString() method to add the extra data but this is obviously wrong.
false
12,167,396
0
0
0
0
ummmm my_text_control.SetValue("some value to set") ?? If you clarify your question ill clarify my answer
0
112
0
0
2012-08-28T20:55:00.000
python,user-interface,wxpython
How to add extra data to a wx.TextCtrl?
0
1
2
12,167,427
1
0
0
I am noticing an issue in my Tkinter application when I create a new Toplevel popup (actually a subclass of tkSimpleDialog.Dialog) and try to navigate through its widgets with the Tab key. It works as expected, except whatever I had selected in a Listbox in my application's main window becomes unselected, as if the widget in the popup took the focus from it. Does anyone know why this is happening and how to prevent it? My Tkinter knowledge doesn't cover how interactions between windows affect the focus...
true
12,184,739
1.2
0
0
2
Solution: When creating the entry widgets in the popup, set their exportselection property to 0. Then selecting them won't affect any other selections.
0
236
0
1
2012-08-29T18:56:00.000
python,tkinter
Widgets in a Tkinter popup taking Tab focus from widgets in another window
0
1
1
12,184,877
1
0
0
Or is there any? I would be happy to know if any. Thank you.
true
12,188,758
1.2
0
0
1
ISAPI on Windows/IIS. NSAPI is supported by a number of vendors.
0
233
0
0
2012-08-30T01:34:00.000
c++,python,c,web-applications,wsgi
Why there is no any standard Gateway Interface for languages C and/or C++ as WSGI for Python?
0
1
2
12,188,910
1
0
0
I'm trying to port a small app to windows (I made it for ubuntu initally), it's written on python + gtk3... I know that gtk3 is hard to make it work on windows (even on c++), but is it possible to make it work on Windows with Python? I do not want to re-write it on another toolkit, and if so, it will probably be wxWidgets, because I'm using an embedded terminal on it (Vte.Terminal()), that IIRC is part of gtk3 too. If it's not possible, is there a way to make a terminal widget on wxPython in Windows?
false
12,199,998
0
0
0
0
I think, the best way is installing python and gtk3 with msys2. firstly install msys2 and install python and gtk3 using msys2. search on Google "how to install python gobject to msys2"
0
3,832
0
4
2012-08-30T15:07:00.000
python,windows,terminal,wxwidgets,gtk3
python + gtk3 on windows?
0
1
3
46,878,690
1
0
0
I am creating an application with wxpython for writing tests in schools, and it needs to be able to block the windows key, alt-tab and so on to prevent cheating. Is this possible and if it is, how do you do it? I know that you can't block ctrl + alt + del, but is it possible to detect when it is pressed?
false
12,210,976
0
0
0
0
The simple answer is No, unless this is a touchscreen application with no access to the computer hardware. That would probably work. Otherwise you'll have to look into how to lockdown your PC with Microsoft Policies etc. Or you might be able to do it with a locked down Linux install. Regardless, it's not really something you can manage with wxPython. It's something you have to manage at the OS level.
0
876
0
1
2012-08-31T07:46:00.000
python,windows,wxpython
Block windows key wxPython
0
1
2
12,216,343
1
0
0
I was using event.unicode for this task previously. If I hit shift+9, then the event for the key down has a unicode attribute of '('. And if I hit shift+alt+9, then the event for the key down has a unicode attribute of '(', and the keyboard also sends a keydown for an alt key, so that I know one was pressed. If, however, I press ctrl+shift+9, then event.unicode == u''. How do I get u'(' back from that? (similarly, for ctrl+shift+a, I get '\x01')
false
12,213,780
0
0
0
0
There is probably an easier way to do this, but you could get the state of all the keys on the keyboard using pygame.key.get_pressed() and then check to see if the two keys pressed are the Ctrl, Shift, and 9 keys. then you could manually return the string Ctrl+( instead of getting that from a function. Not sure if there is a really elegant way to do this though.
0
1,924
0
0
2012-08-31T10:46:00.000
python,pygame
How do I turn the key combination, ctrl+shift+9, into the string "ctrl+(" in PyGame?
0
1
3
12,273,411
1
0
0
I'm a Python newbie but I'm interested in going into the depths of the language. I learned recently how to make simple GUI apps with wxPython and I loved it, I've read around that is the best cross-platform GUI kit around - yet, there are better "native" GUI kits (pyGTK, IronPython (if I'm not mistaken), pyObjc, etc.), but they are individual. Is there a way I can "mix" those GUI libraries into a single app? How can I provide the best GUI experience in a cross-platform app? Any help or suggestions are greatly appreciated.
true
12,234,623
1.2
0
0
0
The grate benefit from wxPython is its use of native widgets where possible, so on GTK platform it'll use GTK, on windows it will use win32, and on mac it will use cocoa/carbon. If you don't write a cross-platform app, then you should better use the specific API to this platform, e.g. pyGTK (Gnome etc.), PyWin32T (Windows) or whatever native toolkit on your platform, as it is normally more updated to the latest API than wxPython.
0
294
0
0
2012-09-02T08:57:00.000
python,user-interface,wxpython,cross-platform
Multiple GUI Kits in a single Python app
0
1
1
12,235,213
1
0
0
Im trying to communicate with a windows application with python. Need to fill in text fields and retrieve results (which are also displayed in text fields). Currently using PywinAuto, works perfectly but its too slow for my purpose. Filling in 6 textfields and pressing two buttons takes 2 to 3 seconds... Im looking for a way to speed this up. What is the fastest way to control and retrieve data from a windows application, that is feasible for a beginner in Python? Thanks in advance.
false
12,238,541
0.099668
0
0
1
This is very difficult. PywinAuto is one of the best ways to handle this kind of problem, but you have to be very careful about which Windows application you are working with. This is because not every Windows application will "publish" it's controls in a reliable way for you to automate. This is particularly true of Mozilla Firefox. However, the Microsoft Office suite does consistently publish just about every control and button on each of its interfaces that I have ever seen. Thus, the real problem is not with PywinAuto, or even with Windows, it is with whoever wrote the application you are trying to automate and whether or not they reliably publish the interfaces you were trying to control. The other question you have to ask yourself is how you are populating the text fields and what is actually taking the time. Filling in fields and buttons should take a fraction of a second if they are independently workable. Otherwise, there is probably something else going on that you should investigate. Good luck. This is a really tough problem.
0
974
0
1
2012-09-02T18:19:00.000
python,pywinauto
Python: communicating with window application
0
2
2
12,282,267
1
0
0
Im trying to communicate with a windows application with python. Need to fill in text fields and retrieve results (which are also displayed in text fields). Currently using PywinAuto, works perfectly but its too slow for my purpose. Filling in 6 textfields and pressing two buttons takes 2 to 3 seconds... Im looking for a way to speed this up. What is the fastest way to control and retrieve data from a windows application, that is feasible for a beginner in Python? Thanks in advance.
false
12,238,541
0.099668
0
0
1
I have been using pywinauto for 1.5 years. And I have tried lots of different tools for UI automation. You know what, pywinauto not the slowest among them. Ofcource some actions can take a long tome (seconds), but as a rule it is a high weith actions, such as count children, etc. Please be sure you do not call findwindows method when it is not realy need.
0
974
0
1
2012-09-02T18:19:00.000
python,pywinauto
Python: communicating with window application
0
2
2
12,903,265
1
0
0
I was playing with wx.Frame.SetWindowStyleFlag() and noticed that to add a new flag I can use either '+' or '|', both resulting the same. My question is, is there a situation where this yields a different result? And is there any performance difference between the 2? I noticed that book like wxPython Application development cookbook use '|' instead of '+'.
true
12,243,454
1.2
0
0
0
I would recommend always using "|". The only time I've seen other bitwise operators used is in the AGW library's demos in the wxPython demo. I doubt there's a difference in speed though. The "|" is the only one I see used regularly and since Robin Dunn (creator of wxPython) is always using it, I think we should too.
0
111
0
0
2012-09-03T07:13:00.000
python,wxpython
wxPython adding Flag
0
1
1
12,266,400
1
0
0
I want to display a list of icons in horizontal format in wxpython. I'm using wxglade and I can't find how to set list's orientation. Each item has an icon and below that it has a caption. Is this kind of design possible?
false
12,252,492
0
0
0
0
The ListCtrl doesn't support that in report mode. I suppose you might be able to do it with one of the other style flags though. However Joran has the right idea. However, I would create a series of wx.Image or wx.StaticBitmap widgets and add them to a horizontal BoxSizer instead of what he did.
0
180
0
0
2012-09-03T18:18:00.000
python,user-interface,wxpython,wxglade
wxpython horizontal listctrl
0
1
2
12,266,335
1
0
0
My question is simple: What is the difference between using pygame.draw and pygame.gfxdraw? I've looked on the pygame documentation, but no one has told what the difference between them is.
false
12,254,516
0.197375
0
0
3
gfxdraw allows anti-aliasing for all shapes, where drawonly adds antialiasing to lines. I use gfxdraw by default. It has been marked 'experimental' for a long time now, but I've not had any issues.
0
2,283
0
5
2012-09-03T22:05:00.000
python,pygame
Difference between pygame.draw and pygame.gfxdraw
0
2
3
12,255,531
1
0
0
My question is simple: What is the difference between using pygame.draw and pygame.gfxdraw? I've looked on the pygame documentation, but no one has told what the difference between them is.
true
12,254,516
1.2
0
0
7
The draw function is a bit more stable, and also a bit faster that gfxdraw, although gfxdraw has more options, not only along the lines of antialiasing, but also drawing shapes. pygame.draw has only nine functions, whereas pygame.gfxdraw has 22 options, which include all 9 of the options supplied by draw. I recommend using gfxdraw even though its is "experimental" because it has more capabilities.
0
2,283
0
5
2012-09-03T22:05:00.000
python,pygame
Difference between pygame.draw and pygame.gfxdraw
0
2
3
12,273,374
1
0
0
I have a Python program which performs a set of operations and prints the response on STDOUT. Now I am writing a GUI which will call that already existing code and I want to print the same contents in the GUI instead of STDOUT. I will be using the Text widget for this purpose. I do not want to modify my existing code which does the task (This code is used by some other programs as well). Can someone please point me to how I can use this existing task definition and use its STDOUT result and insert it into a text widget? In the main GUI program I want to call this task definition and print its results to STDOUT. Is there a way to use this information?
false
12,351,786
-0.07983
0
0
-2
The function which normally prints to stdout should instead put the text into text widget.
0
23,774
0
18
2012-09-10T12:30:00.000
python,tkinter
How to redirect print statements to Tkinter text widget
0
1
5
12,351,926
1
0
0
I have a list of tkinter widgets that I want to change dynamically. How to delete the widgets from the window?
false
12,364,981
0.024995
0
0
1
You say that you have a list of widgets to change dynamically. Do you want to reuse and reconfigure existing widgets, or create all new widgets and delete the old ones? It affects the answer. If you want to reuse the existing widgets, just reconfigure them. Or, if you just want to hide some of them temporarily, use the corresponding "forget" method to hide them. If you mapped them with pack() calls, you would hide with pack_forget() (or just forget()) calls. Accordingly, grid_forget() to hide gridded widgets, and place_forget() for placed widgets. If you do not intend to reuse the widgets, you can destroy them with a straight destroy() call, like widget.destroy(), to free up resources.
0
201,947
0
61
2012-09-11T07:41:00.000
python,tkinter
How to delete Tkinter widgets from a window?
0
1
8
60,425,005
1
0
0
So, I created a simple GUI app using Tkinter, py2app, and numpy. When I run it on my computer it works fine. However, I tested it on a few other computers and kept getting the error: "You can't open the application because the classic environment is no longer supported." I'm not sure I understand the error. The other computers had the same python versions and OS versions as I do? Is there something additional I need to do to make my app work on other machines? Thanks!
false
12,453,675
0.099668
0
0
1
To pull this back from the void. I was having a similar issue. The MAC I was developing on was running 10.8.Something. The target machine was running 10.6+ and I was getting classic environment is no longer supported errors. I looked into architecture flags to no avail. I did find my issues. When emailing the .app (drag and drop into gmail in chrome) to the client the filesize was only 1kb. On the development machine the filesize showed 25Mb+. Pulling this 1kb file from the emails and launching it on the development machine I also got the same error. Turns out drag and drop is not sufficient. I successfully zipped the .app and was able to eliminate this error.
0
643
0
1
2012-09-17T05:42:00.000
python,numpy,tkinter,py2app
py2app/Tkinter application error: "classic environment is no longer supported"
0
2
2
17,708,863
1
0
0
So, I created a simple GUI app using Tkinter, py2app, and numpy. When I run it on my computer it works fine. However, I tested it on a few other computers and kept getting the error: "You can't open the application because the classic environment is no longer supported." I'm not sure I understand the error. The other computers had the same python versions and OS versions as I do? Is there something additional I need to do to make my app work on other machines? Thanks!
false
12,453,675
0.099668
0
0
1
In Mac world classic environment is a software abstraction layer that allowed old Mac apps (e.g G5 hardware architecture) to be executed on new Mac architecture (Intel hardware architecture). Classic environment was supported on pre-10.5 versions of Mac OS X and then dropped in newer versions. py2app supports command-line arguments for building executables to support different architectures, look closer at --arch parameter of py2app.
0
643
0
1
2012-09-17T05:42:00.000
python,numpy,tkinter,py2app
py2app/Tkinter application error: "classic environment is no longer supported"
0
2
2
12,457,682
1
0
0
I would like to run a Python script that normally opens a Qt window remotely over a connection with no X11 forwarding. Is there any way to create some kind of virtual display that the window drawing can be sent to? (some x11-equivalent of /dev/null). The purpose of this is to check that a script works with the API of PyQt4 for different versions of PyQt4, but I want to be able to run this remotely on a server with no display. Any ideas?
false
12,462,796
0
0
0
0
Run a VNC server on the machine; it will start an instance of Xfb, a in-memory version of an X server.
0
846
0
0
2012-09-17T15:48:00.000
python,qt4,pyqt4
Running a PyQt4 script without a display
0
1
2
12,462,897
1
0
0
I'm creating an application with python 2.7 and wxpython 2.8 that should execute a long loop (some hours) on a list of files. I programmed a button that should interrupt the loop as I press it, but at the moment I start the application, it freezes and I can't interact in any way until the loop ends. I also tried to add a small period of sleep with time.sleep, up to 1 second, which is really bad for the speed and doesn't resolve the issue. Is there a way to run this loop "in the background", so that the user can still modify some parameters and more important stop the loop? I can say about the loop that it doesn't require a lot of resources, it just requires a lot of time, so I don't understand why it freezes. Thanks in advance for the help!
true
12,468,644
1.2
0
0
1
Using threads in the standard solution for this type of problem. The wxPython demo under Processes and Events | Threads has a working example of using threads. There are a few issues when running threads from wxPython (and most other guis), so you might want to read the comments in the example, and maybe the wiki to understand what's going on, etc. In particular, wxPython needs to be run from the main thread, so do your file processing in a different thread, and then your file processing should communicate with the main thread using something like wx.PostEvent or wx.CallAfter.
0
193
0
2
2012-09-17T23:53:00.000
python,wxpython
wxPython app frozen during the execution
0
1
1
12,470,183
1
0
0
For a game I am working on I would like to implement a scrolling starfield. All the game so far is being drawn from OpenGL primitives and I would like to continue this and gl_points seems appropriate. I am using pyglet (python) and know I could achieve this storing the positions of a whole bunch or points updating them and moving them manually but I was hoping there was a neater alternative. EDIT: In answer to Ian Mallett I guess what I am trying to ask is if I generate a bunch of points, is there some way I can blit these onto some kind of surface or buffer and scroll this in the background. Also as for what kind of star-field all I am trying to generate at this stage all I am trying for a simple single layer for a top down game, pretty much how you would have in asteroids
true
12,470,417
1.2
0
0
1
Can you clarify what sort of starfield? 2D scrolling (for a side or top scrolling game, maybe with different layers) or 3D (like really flying through a starfield in an impossibly fast spaceship)? In the former, a texture (or layers of textures blended additively) is probably the cleanest and fastest approach. [EDIT: Textures are by far the best approach, but if you really don't want to use textures, you can do the following, which is the next best thing: Make a static VBO or display list of points that is maybe six times as large as it needs to be in the direction of scroll (e.g. if you're running 800x600 screen and you're scrolling horizontally, generate points on a 4800x600 grid). Draw these points twice, offset by the width and the scrolling variable. E.g., let x be your scrolling variable (it starts at 0, then is incremented until it reaches 4800 (the width of your points), and then wraps back around and restarts at 0). Each frame, draw your points with a glTranslatef(x,0,0). Then draw them again with a glTranslatef(x+4800,0,0). In this way your points will scroll past seemingly continuously. The constant (I chose six, above) doesn't really matter to the algorithm. Larger values will have fewer repeats but slower performance. You can also try doing all of the above several times with different scrolling constants to give the illusion of depth (with multiple layers). ] In the latter, there are a bunch of clever algorithms I can think of, but I'd suggest just using the raw points (point sprites if you're feeling fancy); GPUs can handle this if you put them in a static VBO or display list. If your points are small, you can probably throw a few thousand up at a time without any noticeable performance hit.
0
1,710
0
2
2012-09-18T04:33:00.000
python,opengl,pyglet
Scrolling starfield with gl_points in pyglet
0
1
2
12,471,143
1
0
0
I want to execute the Python scripts(that displays a toast and notification) in Android using sl4a. Can I show a toast message and a notification simultaneously? I m using an emulator for testing.
true
12,490,468
1.2
1
0
0
Yes, it is possible to use a toast and a notification at the same time. Although it may be not the best user experience in my opinion. Toast is a way to let the user know of something while he'she is looking at the screen and is low priority. It goes away in a while. Notification is a way to let the user know about something which is higher priority than a toast. It may be at a time where user's primary focus is not your app, or the device is sleeping as well. User can go to the notification drawer and see what's new with your app with this. In most use cases, one of them does the job. I'm not sure why you need both.. at the same time. Doesn't a single notification cut it ?
0
694
0
0
2012-09-19T07:45:00.000
android,python,sl4a
Toast, notification simultaneously in Android
0
1
1
12,490,713
1
0
0
I recently have become interested in GUI programming in Python. I have already had plenty of experience with Pygame, but find that it would be easier just to use the interface that Tkinter, Tix, etc... provide. However, I'm having difficulty finding any decent documentation or tutorials on Tix for Python. (Unlike Pygame, which there are several guides/tutorials that I find quite nice) Where can I find a nice tutorial? (That only assumes knowledge of Python, and hopefully no knowledge of Tk)
false
12,499,465
0
0
0
0
Re the roles of Tix and ttk. They are different things. Tix adds widgets to the standard Tkinter set. ttk adds widgets that duplicate existing widgets but with a configurable look 'n feel. So if you want to make your GUI look like the native OS apps use ttk, but you only get a limited set of widgets. If you want more powerful widgets and don't care about the look as much, then use Tix.
0
8,495
0
6
2012-09-19T17:00:00.000
python-2.7,tkinter,tix
Tix Tutorials in Python
0
1
3
38,350,158
1
0
0
I am making a drawing program in python with pygame right now. The interface is supposed to be vimesque, allowing the user to control most things with key presses and entering commands. I want to allow live binding of the buttons; the user should be able to change which keycode corresponds to which function. In my current structure, all bindings are stored in a dictionary of functions to keycodes, 'bindingsDict.' Whenever the main loop receives a KEY_DOWN event, I execute: bindingDictkeyCode Where keyCode is stored as an integer. This works, but it seems to be taking a lot of time and I am having trouble thinking of ways I could optimize. Does anyone know the big O run time of dict look ups? I assumed because it hashed it would run in ln(n) but there's a huge difference in performance between this solution and just writing a list of if statements in the mainloop (which does not allow for dynamic binding).
true
12,557,562
1.2
0
0
0
It is rather unlikely that dictionary search for response to a user event would cause any noticeable delay on the program. There is something going wrong in your code. Btw, dict and set search in Python is O(log(1)) - but for 105 keys, or even, if you count modifiers applied, about 1000 different keybindngs could be searched in linearly (that is, if the search was O(N) ) without a noticeable delay, even on a 5 year old (desktop) CPU. So, just post some of your code if you want a solution for your problem. (reading the comments I've noticed you found something else that seems to be responsible already)
1
280
0
0
2012-09-24T00:47:00.000
python,algorithm,optimization,pygame,key-bindings
Dynamic key binding in python
0
1
1
12,557,972
1
0
1
I'm making live video GUI using Python and Glade-3, but I'm finding it hard to convert the Numpy array that I have into something that can be displayed in Glade. The images are in black and white with just a single value giving the brightness of each pixel. I would like to be able to draw over the images in the GUI so I don't know whether there is a specific format I should use (bitmap/pixmap etc) ? Any help would be much appreciated!
true
12,580,198
1.2
0
0
2
In the end i decided to create a buffer for the pixels using: self.pixbuf = gtk.gdk.Pixbuf(gtk.gdk.COLORSPACE_RGB,0,8,1280,1024) I then set the image from the pixel buffer: self.liveImage.set_from_pixbuf(self.pixbuf)
0
760
0
2
2012-09-25T09:37:00.000
python,arrays,numpy,gtk,glade
How do you display a 2D numpy array in glade-3 ?
0
1
2
12,638,921
1
0
0
I'm trying to create a dialog that uses two GUI elements: KDEUI KActionSelector and QTExtEdit. I want to have an ability to populate some additional information about the objects in any of the two windows of ActionSelector upon the mouse click. Under the hood: i have a python dictionary. The keys of the dictionary are the entries presented in the ActionSelector. When any of the entries on either side is clicked, i want to be able to catch that signal, understand which key was clicked and show corresponding value in the QTextEdit. That should help user to make a decision about moving or not moving the selected item. If this is not easy than the alternative solution is probably to use two list widgets instead of kActionSelector and reimplement the whole management shebang, but I of course would like to avoid that;) I'm also worried if the usage of KDE element is safe to be used on different machines that might have different versions of Linux running... Thanks!
true
12,591,456
1.2
0
0
0
Unfortunately the API of KActionSelector is a bit cumbersome to use, so I have resorted to implementing the functionality I needed via the use of two QListWidgets and two QPushButtons, marked ">>" and "<<" correspondingly. Upon the button click I'm removing selected element from current list and add it to the list on the other side. Click on any element in either list causes the selected item to be checked against the dictionary, where element is supposed to be a dictionary key. If the element is not present in the dictionary, the KeyError thrown is catched in try:except block.
0
97
0
1
2012-09-25T21:40:00.000
python,pyqt,kde-plasma
KDEUI KAactionSelector widget additional signals (PyQt)
0
1
1
12,647,323
1
0
0
My app use QT for the gui layer, and many other lib I made. One of this other lib is quite complex (it's a type system) and full of asserts to make it as solid as possible. But when an assert is triggered in this lib, the Qt mainloop simply continue. I have a qt_debug() that works well (with pyqtRemoveInputHook) for the Qt part but nothing for the rest of python libraries. And, obviously I would avoid to change code in the library as it should useable without Qt. The best solution would be an assert hook, but despite googling around I didn't any obvious way to do it. Any idea ?
true
12,605,139
1.2
0
0
4
Using assert is the wrong way. For one thing, if Python is run with -O (or -OO) asserts are turned off; for another, the error message is not very helpful. That library needs to be redesigned to properly use exceptions. As far as using the library as it stands: what do you want to have happen? Should your app quit? If so, you could create your own AssertionError class, replace the one in __builtins__ with yours, and have it do whatever you want in its __init__. Note that you are completely on your own if you do this.
0
275
0
0
2012-09-26T15:23:00.000
python,debugging,pyqt
How to globally overload assert so I don't have to change lib code in my PyQT app?
0
1
1
12,605,679
1
0
0
I have a button in wxpython for which I have bound EVT_LEFT_DOWN and EVT_LEFT_UP. I need to know explicitly when it is pressed and released, that's why I'm not using EVT_BUTTON. The events work fine, the problem is just aesthetic: when I bind EVT_LEFT_DOWN and EVT_LEFT_UP the button no longer exhibits the normal appearance of being pressed (shaded and indented). Is there any way to explicitly know when a button is pressed and released but also preserve its default appearance behavior?
true
12,607,326
1.2
0
0
0
So I found a solution for this. If I call event.Skip() in my handlers for EVT_LEFT_DOWN and EVT_LEFT_UP it seems to propagate the event such that the default button appearance behavior is restored.
0
76
0
0
2012-09-26T17:38:00.000
wxpython
How to preserve the default button appearance behavior when binding EVT_LEFT_DOWN
0
1
1
12,607,701
1
0
0
I'm starting to code with pyglet in Windows. I usually rely on Spyder as an IDE, but it seems not to like pyglet. So what would be a convenient way to code / run pyglet in Windows? What is your minimal development setup? Short of obvious minimal setups such as running code on Console2 or using IDLE.
false
12,632,323
0
0
0
0
pycharm, I would highly recommend. The free version has all you need, and is very highly organised. I use it all the time. You'll need to copy your pyglet file into every project tho. Still, it's easy to use and functional, and comes with a lot of good tools.
1
1,228
0
0
2012-09-28T01:17:00.000
python,windows,ide,pyglet
IDE for pyglet?
0
1
5
62,126,569
1
0
0
I've made a .app with my WxPython script, and it's just about finished. The problem is, the menu bar title reads "Python". How can this be changed? Would I use wx.Menu()/wx.MenuBar(), or is this a problem with the .app file itself?
true
12,633,100
1.2
0
0
5
Be sure to use Py2app, and make sure the .plist is filled out correctly, IE CFBundleName and CFBundleDisplayName.
0
1,492
0
3
2012-09-28T03:09:00.000
python,wxpython,.app
Changing WxPython app Mac menu bar title?
0
1
2
12,755,571
1